作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
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/
我有以下正则表达式 /[a-zA-Z0-9_-]/ 当字符串只包含从 a 到z 大小写、数字、_ 和 -。 我的代码有什么问题? 能否请您向我提供一个简短的解释和有关如何修复它的代码示例? //var
我是一名优秀的程序员,十分优秀!