FamilySearch/fs-js-lite

Change middleware API

Closed this issue · 0 comments

Supporting node #11 requires supporting errors #12 which means middlware must also account for them. I believe that we only need to change the behavior of next().

Requests

Request middleware may return an error, a new response, or nothing.

next(error, newResponse)

Responses

Response middleware may return an error or cancel the response middlware chain because a new request was issued (throttling or redirects).

next(error, cancel)