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

Handles optional request bodies #70

Closed
emilien-puget opened this issue Apr 26, 2024 · 2 comments · Fixed by #71
Closed

Handles optional request bodies #70

emilien-puget opened this issue Apr 26, 2024 · 2 comments · Fixed by #71

Comments

@emilien-puget
Copy link
Contributor

As i just discovered, request bodies are optional by default.
see https://spec.openapis.org/oas/v3.1.0#fixed-fields-10 or https://swagger.io/docs/specification/describing-request-body/
this dear library doesn't handle such cases

contentType := request.Header.Get(helpers.ContentTypeHeader)

as we can see above, if an operation has a request body, we will require to have a content type set, however that request body could be not required which means that a content type should not be required.

i haven't go any further in my investigation, maybe the underlying lib is already capable of handling such cases, any if we agree that this is not an expected behavior i can propose a fix in a few hours/days.

@daveshanley
Copy link
Member

Yeah, I agree if required is set to false (which as you pointed out, is the default), then the library should be able to handle it.

@emilien-puget
Copy link
Contributor Author

here it is #71

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

Successfully merging a pull request may close this issue.

2 participants