-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: post 方法,Content-Type逻辑判断有疑问!!! #23
Comments
后面有代码:req.Header.Set("Content-Type", w.FormDataContentType()) 会设置。 |
Content-Type", "application/x-www-form-urlencoded。顺便说下,是这个头 |
你把你的测试代码发一下,我看看。 |
|
好的,我测试出来了,我试着改改 |
我把if 判断去掉了。不过这样多次调用,他会不会重复加。你试试吧。 |
419行,有一个问题,强制设置的话,别人就不能自己改了。这不好。 |
你看后面,在解析外部传来的header的时候,会重新设置header。用户的传参如果设置了会直接覆盖这个默认逻辑。也就是说。用户的设置相当于优先级最高。 |
单纯去掉if。应该是不行的。 因为我看到。header的数据结构为:type Header map[string][]string 所以,set是合适的。add不合适。因为一直add不是我们的想法。也会造成内存问题。 |
我现在的做法是 强制设置了 content-type,如果你想改变每次都加在header里设置。 |
意思是,设置了。进行覆盖。没设置,不管了?
是不是应该是,没设置进行设置?
The text was updated successfully, but these errors were encountered: