-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Cannot calculate proper length in synchronous way. (node-fetch + form-data) #102
Comments
This is a hack to support |
I've tried to send following body: form.append('my_file', fs.createReadStream('/foo/bar.jpg')); |
Due to the nature of callback, we don't currently use |
I have worked around this bug for the moment by removing the
Some servers don't like it not having a |
@mcfedr please don't do this, why can't you call UPDATE: see my reply here #106 (comment) |
Alternative, don't use |
For local files its possible to use I am sending another stream, and I dont know the length of the stream. Here are example of how things are broken, these are bugs in both https://gist.github.com/mcfedr/0a6fbaeaf0cfaddbeadfe145c002c8e5 I think in the 'http' example node-fetch should ignore the correctly thrown error and be ok with not setting a content-length In the 'fetch' example form-data needs to throw the error because it doesnt know its length |
Quick summary: unfortunately
|
No response from form-data dev, I am going with option 3. |
@havenchyk I will update this issue when release, but you should read my reply above #102 (comment) |
@bitinn thanks for the quick response. I actually read it and understand that I need to skip the check somehow. My problem is that everything worked fine for a year and now it's broken. I'm trying to figure out, is it a problem of FormData(maybe from last releases) or of node-fetch. |
@havenchyk my work around works, #102 (comment) |
@havenchyk I need to see the error to conclusively say you are facing the same problem. But |
workaround has been added and released as v1.5.3 |
This line causes the error: https://github.com/bitinn/node-fetch/blob/master/index.js#L96
The text was updated successfully, but these errors were encountered: