-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General improvements #13
base: master
Are you sure you want to change the base?
Conversation
…the data to be sent. Options are passed on the third argument.
Will check this. Looking pretty solid. |
Object.assign(baseHeaders, headers) | ||
) | ||
|
||
return { | ||
...otherOptions, | ||
headers: headersObject, | ||
body: data ? JSON.stringify(data) : null | ||
body: data ? JSON.stringify(data) : undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to understand, why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this JakeChampion/fetch#402. Particularly, Edge was failing with the error Failed to execute 'fetch()' on 'Window': HEAD or GET Requests cannot have a body
.
Related: agraboso/redux-api-middleware#138
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. I can't merge this until releasing the new version of mobx-rest
though. The breaking changes must be applied there first.
This works in conjunction with masylum/mobx-rest/pull/39.
Changes
patch
andhead
requests.errorUnwrap
that keeps the previous behavior of returningerror.errors || {}
when the request fails, but allows overriding.qs.stringify
. In my particular case I'm doing this:Breaking changes
apiPath
tourlRoot
.commonOptions
todefaults
.fetch-ponyfill
. If the host app already has a polyfill this will just be adding unused bytes. I think the developer should include a fetch polyfill in his app, if needed.{ requestResponse, error }
,requestResponse
being the original request response object anderror
the result oferrorUnwrap
. This allows to get response headers, status, etc.Fixes
undefined
body whenoptions.data
is not specified. TypeError: HEAD or GET Request cannot have a body. JakeChampion/fetch#402Notes
We aren't using the
jquery-adapter
, so these changes will have to be applied/tested there also.