How to stream request body? #85
-
I have a server that accepts a streamed request body. How can I stream a local file to the server using this library? I see there's a function for streaming from Server to Local but not from Local to Server. This can be done using the folliwing: curl -X POST --data-binary @/path/to/large/file localhost:3000 In Python, this is done by passing the file handler to the with open(filepath, 'rb') as f:
r = requests.post(url, data=f) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I’m on mobile, but you can use https://pkg.go.dev/github.com/carlmjohnson/requests#Builder.BodyReader or https://pkg.go.dev/github.com/carlmjohnson/requests#Builder.BodyWriter depending on the source. |
Beta Was this translation helpful? Give feedback.
I’m on mobile, but you can use https://pkg.go.dev/github.com/carlmjohnson/requests#Builder.BodyReader or https://pkg.go.dev/github.com/carlmjohnson/requests#Builder.BodyWriter depending on the source.