Closed TomiS closed 9 months ago
Yes https://github.com/rescript-lang/rescript-compiler/pull/6354 removed _
mangling; in earlier compiler versions the _
prefix was introduced as a way to allow binding to JS names that were reserved words in ReScript. Now instead of _method
compiling to method
it's emitting _method
. As a result your fetch call is not actually specifying a method and falling back to the default.
I'll try to find some way to fix this without breaking ReScript 10 compatibility. It would be a shame to need a breaking version change just for v11 support.
If I can't make it work I might just pull fetch out and link to rescript-fetch instead (the fetch support in webapi was pulled from glenn's bs-fetch
which I thought was abandoned).
Sounds good. Thanks for clarifying.
Edit: Though I think _type
is still a keyword that needs to be mangled even in RS 11, right?
I didn't see your edit. That's... probably something I should've reported to the compiler team. Hmm.
Hey, I'm not sure if this is a ReScript 11 thing or something else, but in order to make fetching work properly, I needed to change this line and this line in such way that neither have underscore as prefix
e.g.
=>
The current implementation does not work when using
DELETE
as method (at least). It causes an errorTypeError: Failed to construct 'Request': Request with GET/HEAD method cannot have body.