Request Method:OPTIONS not making POST
See original GitHub issueHi there,
I have a mapping set up to return 200 when a OPTIONS request is made. It returns the 200 but then doesn’t continue with the original request.
Basically I make a POST request to a service ( Which I have mapped and mocked) bu the pre-flight request is mapped returns 200 but then that’s it. It never makes the POST.
Any ideas or help would be great. Here is my OPTIONS mapping.
{
"request": {
"url": "/service/security/getDetailsInfo",
"method": "OPTIONS"
},
"response": {
"status": 200,
"headers": {
"Access-Control-Allow-Origin": "http://localhost:8080",
"Access-Control-Allow-Headers": "OWASP_CSRFTOKEN, X-Requested-With",
"Access-Control-Allow-Methods": "GET, POST"
}
}
}
and here is the POST mapping
{
"request" : {
"url" : "/service/security/getDetailsInfo",
"method" : "POST",
"headers" : {
"Accept" : {
"equalTo" : "*/*"
}
}
},
"response" : {
"status" : 200,
"bodyFileName" : "details.json",
"headers" : {}
},
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Why am I getting an OPTIONS request instead of a GET ...
10 Answers 10 · It uses methods other than GET or POST. · It sets custom headers in the request (e.g. the request...
Read more >Why is my browser sending an OPTIONS HTTP request ...
As you can see, the POST method is never sent and only a method called OPTIONS is sent to the endpoint. The response...
Read more >Request Method:OPTIONS not making POST #650 - GitHub
Hi there,. I have a mapping set up to return 200 when a OPTIONS request is made. It returns the 200 but then...
Read more >Why Is an OPTIONS Request Sent? - Baeldung
Learn why an OPTIONS HTTP request is sent. ... Sometimes, we're not able to make the request a same-origin request or a simple...
Read more >OPTIONS - HTTP - MDN Web Docs - Mozilla
POST , GET , and OPTIONS are permitted methods for the URL. (This header is similar to the Allow response header, but used...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If someone is interested, I have the solution for all your OPTIONS requests :
{ "request": { "urlPathPattern": ".*", "method": "OPTIONS" }, "response": { "status": 200, "headers": { "Access-Control-Allow-Origin": "http://localhost:8080", "Access-Control-Allow-Headers": "OWASP_CSRFTOKEN, X-Requested-With, Authorization", "Access-Control-Allow-Methods": "GET, POST" } } }
Secret is :
"urlPathPattern": ".*"
for all requests❤️
Hey, I can’t remember exactly what they were but it was something like this.
{ "request": { "url": "*", "method": "OPTIONS" }, "response": { "status": 200, "headers": { "Access-Control-Allow-Origin": "http://localhost:8080", "Access-Control-Allow-Headers": "OWASP_CSRFTOKEN, X-Requested-With", "Access-Control-Allow-Methods": "GET, POST" } } }
Basically, I just needed to make this mapping a kind of catch all for all OPTIONS requests regardless of the url. Hope this makes sense.
If you are having trouble figuring out what gets returned you could try the recording functionality and capture all the correct headers. That’s what I did.