Closed adamcrown closed 10 years ago
Is it possible for someone to set a body_stream even when not using multipart-post? If so maybe the net_http adapter should just check both body and body_stream. What do you think?
There is a HTTPGenericRequest#body_stream
it seems fairly undocumented and unused. A google search doesn't turn up a whole lot. But I'd be happy to submit another pull request to handle that. It would probably be a much smaller change to the codebase.
That would be great. If I'm looking at multipart-post code correctly, it looks like it is just relying on the default behavior of HTTPGenericRequest#body_stream
and just adding in features to handle setting Content-Type and boundaries correctly.
I think adding it to the net_http adapter would thus add the most robust support (even if the feature isn't used often outside of multipart-post).
Posted a new pull request #49
Although multipart-post uses Net::HTTP the Content-MD5 isn't properly calculated when files are attached because multipart-post uses body_stream instead of body. This driver should solve that.