Closed darylldoyle closed 5 years ago
When using createSingle() or updateSingle() the header options set in the handler on initialisation are overwritten by the options passed to this.fetch()
createSingle()
updateSingle()
this.fetch()
const options = { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify( data ), }; return this.fetch( this.url, { context: 'edit' }, options )
For this reason, it's not possible to use repress to create items that need auth by using an Authorization header (JWT for example).
I'd suggest switching the order of the options being spread in the fetch() method so that the headers set on the handler take precedent.
fetch()
I'd rather solve it with deep merging per #29. I think I actually have a patch for this somewhere...
Found the patch, so closing this one. Thanks for the time though!
When using
createSingle()
orupdateSingle()
the header options set in the handler on initialisation are overwritten by the options passed tothis.fetch()
For this reason, it's not possible to use repress to create items that need auth by using an Authorization header (JWT for example).
I'd suggest switching the order of the options being spread in the
fetch()
method so that the headers set on the handler take precedent.