0

Long story short, I am using node-fetch to upload a file to a Rails server.
The file is from fs.createReadStream = ReadStream.

https://github.com/node-fetch/node-fetch

Note: when body is a Stream, Content-Length is not set automatically.

As it says in the readme, when it's a stream, the request's content-length will not be set by node-fetch.

  • When receiving the data with Rails v6, it somehow setups the request's content-length even though the client is not sending the length.
  • When receiving the same data with Rails v5, it doesn't setup the content-length.

I am trying to monkey-patch v5 with what they did in v6.
Does anyone know how v6 does that?

kukrt
  • 2,117
  • 3
  • 21
  • 32

1 Answers1

0

It was actually puma..
https://github.com/puma/puma/pull/2287

it's fixed v4.3.7 and on.
https://github.com/puma/puma/blob/master/History.md#437--2020-11-30

kukrt
  • 2,117
  • 3
  • 21
  • 32