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

js处理请求头信息时大小写问题 #184

Open
ztxtop opened this issue Sep 12, 2023 · 4 comments
Open

js处理请求头信息时大小写问题 #184

ztxtop opened this issue Sep 12, 2023 · 4 comments

Comments

@ztxtop
Copy link

ztxtop commented Sep 12, 2023

在js中使用$request.headers获取请求头信息时,目前的新版本返回的都是小写的请求头key(即使原始的请求头是首字母大写的),这可能让后续的一些业务判断无法进行;能否让$request.headers和$response.headers取得的信息跟原请求响应是一致的呢

@ztxtop ztxtop changed the title js js处理请求头信息时大小写问题 Sep 12, 2023
@ztxtop
Copy link
Author

ztxtop commented Sep 17, 2023

响应的响应头好像也是返回的全小写

@elecV2
Copy link
Owner

elecV2 commented Sep 18, 2023 via email

@ztxtop
Copy link
Author

ztxtop commented Sep 21, 2023

为了统一都转换成了小写。但在脚本中是可以通过大写开头来获取对应值的,比如 $request.headers.Accept在 2023年9月17日,10:11,ztxtop @.> 写道: 响应的响应头好像也是返回的全小写 —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.>

了解了,不过响应头都转成小写后,在js脚本中如果添加了首字母大写的响应头,并不会自动转换成小写,这样对于想在脚本中覆盖原有响应头的操作就无效了,目前我遇到的是想覆盖302重定向的Location,因脚本也在surge上使用(surge、qx等工具没有转小写的操作),这就导致需要脚本中作判断了才能正确覆盖响应头了

@elecV2
Copy link
Owner

elecV2 commented Sep 22, 2023 via email

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