Skip to content
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

请问怎么设置请求头变量大写不转换成小写 #335

Open
GostGrimmy opened this issue Mar 18, 2024 · 2 comments
Open

请问怎么设置请求头变量大写不转换成小写 #335

GostGrimmy opened this issue Mar 18, 2024 · 2 comments

Comments

@GostGrimmy
Copy link

	SetHeaders(map[string]string{
			"User-Agent":      "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
省略...

这是日志

upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36

发出去的时候请求头好像转成了小写

@imroc
Copy link
Owner

imroc commented Mar 18, 2024

这是 HTTP2 吧,HTTP2 规范规定 header 必须都是小写,只有HTTP1才允许设置大小写

@imroc
Copy link
Owner

imroc commented Mar 18, 2024

HTTP1可以用SetHeadersNonCanonical设置保留 header 的大小写

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants