How to send chunked HTTP request from client side javascript (not from Nodejs)?

Viewed 1058

I cannot find any way to start and manage a chunked request from client side javascript (whether it is a browser or React Native).

On the contrary Node.js provides the http module using which you can do the same task and write() the request body gradually.

My Question: Is there anyway to initiate a chunked HTTP request from client side javascript?

Note: That question is NOT about receiving a chunked response. I want to send a chunked request.

Example:

var http = new XMLHttpRequest();
var url = 'some_url';
var body = 'The whole body data';
http.open('POST', url, true);

// Whatever the content type
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

// The whole data has to be ready and sent at once.
// How to stream the body? send it in chunks?
http.send(body);
0 Answers
Related