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

I can't send POST method #210

Closed
turbobin opened this issue Oct 24, 2019 · 5 comments
Closed

I can't send POST method #210

turbobin opened this issue Oct 24, 2019 · 5 comments
Labels
need information Requires more info need testing Needs to be tested before merging onto production

Comments

@turbobin
Copy link

hi,
I meet a strange problem, when I choose POST method to send, it always turn on OPTIONS, why ? look at the image:

image

@liyasthomas
Copy link
Member

liyasthomas commented Oct 24, 2019

@turbobin Thanks for reporting the bug. Sorry for the inconveniences caused. Could you please share the API endpoints so that we could run some manual tests.

We couldn't reproduce the issue with any other endpoints. Meanwhile, you can try sending requests in Content Type: application/json and see if the issue persists.

@liyasthomas liyasthomas added need information Requires more info need testing Needs to be tested before merging onto production labels Oct 24, 2019
@NBTX
Copy link
Contributor

NBTX commented Oct 25, 2019

The OPTIONS request being sent first is a CORS preflight request that gets made automatically when POSTing data to a server. The POST request doesn't get sent as the OPTIONS preflight request is failing.

This is a 'feature' of the browser that we have no control over, so this issue will require use of the Postwoman proxy.

EDIT: You can read more about preflight requests here; https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request

@NBTX
Copy link
Contributor

NBTX commented Oct 25, 2019

Also @liyasthomas we could perhaps try and detect this (for the purposes of prompting the user to turn on the proxy) by sending our own preflight request first if the proxy is turned off (i.e. just making a request to OPTIONS) - we'd get an 'opaque' response but it would be enough to know it's going to fail and therefore know that we need to prompt the user with a message.

@liyasthomas
Copy link
Member

liyasthomas commented Oct 25, 2019

Thats doable. Now we check Access-Control-Allow-Origin: * to detect whether CORS occur or not. Think we could op for this method instead.

@liyasthomas
Copy link
Member

Closing this issues since it's a possible duplicate of #274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need information Requires more info need testing Needs to be tested before merging onto production
Projects
None yet
Development

No branches or pull requests

3 participants