代理服务修改postbody内容相关问题

发布时间 2023-04-28 12:06:02作者: burton_shi

1. 如果修改了postForm 的内容,那么需要同步修改 请求的 contentType 的值,对于 go 来说需要修改的是 request.ContentType 里的值

  以下是 源码中关于 contenType 字段的注释

ContentLength records the length of the associated content.
The value -1 indicates that the length is unknown.
Values >= 0 indicate that the given number of bytes may
be read from Body.

For client requests, a value of 0 with a non-nil Body is
also treated as unknown.

  翻译:

   ContentLength 表示关联内容的长度。

    • -1 表示长度未知。
    • >= 0 的值表示可以从 Body 中读取指定字节数。
    • 对于客户端请求,当 Body 不为 nilContentLength0 时,也被视为长度未知。

  

todo: 补充整个 http 请求的流程,每个header 参数在那个地方拼接的