gospider007 / requests

🚀A next-generation HTTP client for Golang, Support ja3, ja4, http,http2,http3,websocket,sse ,tls fingerprint modification
GNU General Public License v3.0
116 stars 21 forks source link

Ability to add a key into the order map #12

Closed shrimpwtf closed 3 months ago

shrimpwtf commented 3 months ago

Really simple fix to be able to add just a key into a order map, for dynamically computed headers such as 'Host' and still retain their order.

gospider007 commented 3 months ago

Really simple fix to be able to add just a key into a order map, for dynamically computed headers such as 'Host' and still retain their order.

你应该用Set("host","test.com") 这个方法

shrimpwtf commented 3 months ago

Sometimes I have dynamic code where the host header is not known at runtime, it's easier to just have the code automatically handle it rather than having to parse a URL. I made a PR to help do this.

shrimpwtf commented 3 months ago

With content-length too for example, your code has a lot of dynamic types etc, can't simply just add the key to respect the proper header ordering and can't compute the length if you're just feeding in a struct and letting the software handle it. From a Quality of Life standpoint this is really needed.

gospider007 commented 3 months ago

With content-length too for example, your code has a lot of dynamic types etc, can't simply just add the key to respect the proper header ordering and can't compute the length if you're just feeding in a struct and letting the software handle it. From a Quality of Life standpoint this is really needed.

我明白了,如果合并你的代码在orderMap 中添加的话会有bug, 我会新增 orderHeaders 参数 来设置请求头顺序

shrimpwtf commented 3 months ago

Thankyou :)

gospider007 commented 3 months ago

https://github.com/gospider007/requests/blame/master/test/fingerprint/ja4_test.go#L53