fix: fetchNoCors and http_request data handling #664
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please tick as appropriate:
Description
This PR solves 4 problems:
fetchNoCors
does not prefix explicitly specified headers which can later be overwritten or deleted byhttp_request
handler. Arguably, if the user has specified headers explicitly then they must be sent out in the end.http_handler
would automatically decompress received data, but not intended to do so. Decompressing is now delegate to JS engine.fetchNoCors
would cache the the request incorrectly under a generichttp://127.0.0.1:1337/fetch
url if the server response asks it to. Caching could be disabled completely forfetchNoCors
, however another approach was taken - url is added as a query parameter so that the cache is associated correctly with the provided url.http_handler
no longer has special headers forauth
andurl
, and are now parsed from query only. Replaced theget
methods with access operators so that the exception is thrown early on an ill-formed url to avoid confusing exceptions down the line.