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

autoSortRequestHeaders for preflight requests #25

Open
iamoskvin opened this issue Oct 21, 2024 · 6 comments
Open

autoSortRequestHeaders for preflight requests #25

iamoskvin opened this issue Oct 21, 2024 · 6 comments

Comments

@iamoskvin
Copy link

This is a very nice option.
It could be helpful to add proper sorting for OPTIONS (preflight) requests, too.

@Ossianaa
Copy link
Owner

OPTIONS requests are not actively sent, If you send OPTIONS requests like requests.options(...), it will be sorted automatically

@Ossianaa
Copy link
Owner

OPTIONS requests are not actively sent, If you send OPTIONS requests like requests.options(...), it will be sorted automatically

As far as I know curl doesn't send preflight OPTIONS

@iamoskvin
Copy link
Author

OPTIONS requests are not actively sent, If you send OPTIONS requests like requests.options(...), it will be sorted automatically

As far as I know curl doesn't send preflight OPTIONS

Yes, I am sending preflight requests manually (to mimic Chrome) before POST requests. And headers are sorted incorrectly automatically.
But I also saw a couple of cases when sort was wrong even for GET requests, for now I just fixed the order manually in this case.

@Ossianaa
Copy link
Owner

OPTIONS requests are not actively sent, If you send OPTIONS requests like requests.options(...), it will be sorted automatically

As far as I know curl doesn't send preflight OPTIONS

Yes, I am sending preflight requests manually (to mimic Chrome) before POST requests. And headers are sorted incorrectly automatically. But I also saw a couple of cases when sort was wrong even for GET requests, for now I just fixed the order manually in this case.

can you give me code and right sort headers ?

@iamoskvin
Copy link
Author

iamoskvin commented Oct 24, 2024

OPTIONS requests are not actively sent, If you send OPTIONS requests like requests.options(...), it will be sorted automatically

As far as I know curl doesn't send preflight OPTIONS

Yes, I am sending preflight requests manually (to mimic Chrome) before POST requests. And headers are sorted incorrectly automatically. But I also saw a couple of cases when sort was wrong even for GET requests, for now I just fixed the order manually in this case.

can you give me code and right sort headers ?

Here is the sort of headers for preflight request. And what code should I provide? Did not get it. Thanks.

   Header: accept: */*
    Header: access-control-request-method: POST
    Header: access-control-request-headers: authorization,content-type
    Header: origin: chrome-extension://...
    Header: user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
    Header: sec-fetch-mode: cors
    Header: sec-fetch-site: cross-site
    Header: sec-fetch-dest: empty
    Header: accept-encoding: gzip, deflate, br, zstd
    Header: accept-language: en-US,en;q=0.9
    Header: priority: u=1, i

@Ossianaa
Copy link
Owner

95afc76 should fix the problem

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