-
Notifications
You must be signed in to change notification settings - Fork 53
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
HeadersInit.makeWithArray #7
Comments
Hmm, it might not be very well supported, but it's still in the spec from what I can see: https://fetch.spec.whatwg.org/#example-headers-class MDN and github/fetch makes no mention of it however... Is the generated JavaScript as you'd expect? Edit: node-fetch supports it: https://github.com/bitinn/node-fetch#class-headers as does github/fetch, it's just not documented: https://github.com/github/fetch/blob/master/fetch.js#L87-L90 and Firefox: https://github.com/mozilla/gecko-dev/blob/master/dom/fetch/Headers.cpp#L73-L74 |
@glennsl let headers = Bs_fetch.HeadersInit.make [%bs.obj { content-type = "application/json" }] |
Hmm... In Reason you'd be able to use
But in OCaml I suppose you could use a |
How would you do that? I didn't see find anything in the BuckleScript documentation of casting between JS types. edit: I am guessing |
No, you'd have to define the cast yourself:
|
@glennsl Thanks, that works. |
@glennsl Would you be willing to add |
It would make more sense in I'm working on a slightly higher-level and much more idiomatic library that builds on bs-fetch, and will probably revamp and make these bindings much lighter once that's out. I'll also fix issues like this then. |
I had a similar problem when trying to use Ended up just using
|
Had the same problem using react native, I guess the array initialization is not supported widely enough :( I used HeadersInit.makeWithDict(
Js.Dict.fromList([
("Authorization", "Bearer " ++ accessToken),
]),
) |
Hello,
I'm having trouble using
HeadersInit.makeWithArray
. When I use it, I do not see theAuthorization
header being sent along with my request. When I useHeadersInit.make
with an object literal, it works properly:I'm not sure if it's something I'm doing incorrectly, or a bug in the library -- thought I'd raise an issue and find out!
The text was updated successfully, but these errors were encountered: