question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OPTIONS request for route with Header/Body fails with 400

See original GitHub issue

To properly provide for CORS, each endpoint must support OPTIONS method to prevent CORS preflight channel did not succeed.

This normally works for endpoints without required Headers or Body. OPTIONS of such endpoints with fail with:

{"message":"Missing/invalid parameters","params":[
   {"name":"body","type":"body","datatype":"object","required":true,"reason":"Invalid"}
]}

I believe this is a bug as these parameters should not be required for OPTIONS method call.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
daviddentoncommented, Oct 21, 2020

Looks like the PreFlightExtractionFilter isn’t ignoring the post requests. For the moment you can define your own one and add it at the contract level.

https://github.com/http4k/http4k/blob/master/http4k-contract/src/main/kotlin/org/http4k/contract/PreFlightExtraction.kt

0reactions
knyttlcommented, Oct 21, 2020

superb!

Read more comments on GitHub >

github_iconTop Results From Across the Web

NET Web API + AngularJS: CORS OPTIONS Request fails ...
NET Web API + AngularJS: CORS OPTIONS Request fails with 400 Bad Request · Ask Question ... In Fiddler, the OPTIONS request looks...
Read more >
Error handling — tapir 1.x documentation - SoftwareMill
A 400 Bad Request response is returned if a query parameter, header or body causes any decode failure, or if the decoding a...
Read more >
OPTIONS - HTTP - MDN Web Docs
The HTTP OPTIONS method requests permitted communication options for a given URL or server. A client can specify a URL with this method, ......
Read more >
curl_getinfo - Manual - PHP
CURLINFO_HEADER_OUT - The request string sent. For this to work, add the CURLINFO_HEADER_OUT option to the handle by calling curl_setopt() ...
Read more >
API: Postman HTTP Requests - Dotcom-Monitor
Testing APIs with Postman Explained · Adding a new HTTP request using the Postman interface. · Customizing the request (specifying an HTTP method,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found