3

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);
Meena Alfons
  • 1,200
  • 2
  • 11
  • 29
  • Possible duplicate of [How to write javascript in client side to receive and parse \`chunked\` response in time?](https://stackoverflow.com/questions/6789703/how-to-write-javascript-in-client-side-to-receive-and-parse-chunked-response-i) – Doğancan Arabacı Jan 07 '19 at 09:08
  • No .. I do not want to receive a chunked **response**. I want to send a chunked **request**. – Meena Alfons Jan 07 '19 at 09:12

1 Answers1

-1

I would suggest you to go through the below link it might help you out https://gist.github.com/CMCDragonkai/6bfade6431e9ffb7fe88 enter link description here

Hope this will clear you out !

nikzbamne
  • 24
  • 3
  • 1
    Could you possibly extend your answer to contain more information but just the link? https://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers – Wiktor Zychla Jan 07 '19 at 09:27
  • 1
    I've already read this and it does not answer my question. It clearly says that "Chunking is a 2 way street. The HTTP protocol allows the client to chunk HTTP requests." but it does not say **HOW** it can be done in browser. – Meena Alfons Jan 07 '19 at 09:28
  • ok can share with me how your sending single HTTP request from client side ? – nikzbamne Jan 07 '19 at 09:32
  • 1
    @user7434119 added example. – Meena Alfons Jan 07 '19 at 09:53
  • Does not answer the question. The OP was very specific – Navin Jan 08 '21 at 07:42