【发布时间】:2019-06-01 22:26:32
【问题描述】:
我找不到任何方法来启动和管理来自客户端 javascript(无论是浏览器还是 React Native)的分块 request。
相反,Node.js 提供了 http 模块,您可以使用它来完成相同的任务,并逐渐write() 请求正文。
我的问题:是否可以从客户端 javascript 发起分块 HTTP 请求?
注意:这个问题不是关于接收分块的响应。我想发送一个分块的请求。
例子:
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);
【问题讨论】:
-
不.. 我不想收到分块的响应。我想发送一个分块的请求。
标签: javascript http