gpt4 book ai didi

http - 去 block 上传

转载 作者:行者123 更新时间:2023-12-01 22:33:31 24 4
gpt4 key购买 nike

go 支持 block 上传吗?
我将上传文件作为一份分段上传。
据我所知:type Part表示多部分正文中的单个部分,func (*Part) Read在其标题之后和下一部分(如果有)开始之前读取部分的主体。
我假设 Reader不打扰是否是 block 上传,它只是读取字节直到EOF。
GoDoc

type Part struct {

// r is either a reader directly reading from mr, or it's a
// wrapper around such a reader, decoding the
// Content-Transfer-Encoding
r io.Reader
GoDoc
   // If Body is present, Content-Length is <= 0 and TransferEncoding
// hasn't been set to "identity", Write adds "Transfer-Encoding:
// chunked" to the header. Body is closed after it is sent.
func (r *Request) Write(w io.Writer) error {
return r.write(w, false, nil, nil)
}

我应该如何像往常一样处理分段 block 上传,或者我应该调整一些东西?

最佳答案

net/http客户端和服务器支持分 block 请求体。当在写入 header 时内容长度未知时,客户端会自动使用分 block 编码。应用程序无需执行任何操作即可启用该功能。

关于http - 去 block 上传,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63449026/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com