-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Problem sending blobs #75
Comments
Hi @onel,
The thing is, In your case the I could add a check specifically for So I think the correct way to send a Blob would be to use the const b = new Blob([1, 2, 3])
wretch('...').body(b).put()//.res()/json()… |
Thanks for the details @elbywan
|
The Readme actually states that the body is set in a opinionated way. Excerpt: // This shorthand:
wretch().post({ json: 'body' }, { credentials: "same-origin" })
// Is equivalent to:
wretch().json({ json: 'body'}).options({ credentials: "same-origin" }).post()
Indeed it is not clear enough and I will add a note to make it more explicit. Thanks for pointing this out!
Assuming that the payload is a JSON (which is much more common than a Blob or TypedArray) is a very handy shortcut to use. (
True 👍. I will make the change and remove the JSON assumption if the |
Just published the version |
Awesome. Thanks for the quick fix 👍 This is a great lib |
Thanks! 😄 Closing the issue since the fix was published in the latest version. |
Hey @elbywan, apologies for re-opening this but I felt it was relevant to the conversation. The changes made here are great, especially when compared to other Unfortunately this only checks for the existence of a It's fairly easy to workaround this by just passing the headers to the ** Works - Blob is sent without being stringified **
** Doesn't Work - Blob is stringified before being sent **
|
Hi @RBrNx,
No worries. 😄
Absolutely, good catch, thanks for reporting this! I've just released a new version |
This might be more of a question than a bug.
I'm trying to send a blob using wretch and the it looks like only
{}
is being sent.Example:
Am I doing something wrong here?
The text was updated successfully, but these errors were encountered: