Fetch的Response.body块是否对应于HTTP块? [英] Does Fetch's Response.body chunks correspond to HTTP chunks?

查看:105
本文介绍了Fetch的Response.body块是否对应于HTTP块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在执行Fetch-api请求,其中服务器使用HTTP分块传输编码(带有文本数据)进行回复.我正在使用Response.body作为流来使用数据.

I'm doing a Fetch-api request where the server replies using the HTTP chunked transfer encoding (with text data). I'm consuming the data using the Response.body as a stream.

我想知道:假设流生成的块对应于HTTP块是否安全?我看过一些问题[1-3]似乎在做这个假设,但是我在规范中找不到任何有关此的东西.

I'm wondering: Is it safe to assume that the chunks generated by the stream correspond to the HTTP chunks? I've seen some questions[1-3] where this assumption seems to be made, but I cannot find anything about this in the spec.

[1] JS Fetch使用分块传输编码(将curl转换为Fetch)
[2] 在javascript中异步使用分块数据
[3] 使用Fetch API读取分块的二进制响应

[1] JS Fetch use Chunked Transfer Encoding (translating curl to Fetch)
[2] Consuming chunked data asyncrhonously in javascript
[3] Read chunked binary response with Fetch API

推荐答案

作者的评论:没有这样的保证……例如,如果在一半的HTTP块之后有延迟,我希望有两个左右"..

这篇关于Fetch的Response.body块是否对应于HTTP块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆