-
Notifications
You must be signed in to change notification settings - Fork 352
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
allow for empty request bodies to skip validation, fixes #1939 #1990
Conversation
@@ -0,0 +1,26 @@ | |||
====test==== | |||
Given form data expected in request body |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess i should update these
7db1716
to
0e36fcc
Compare
return E.right(body); | ||
} | ||
|
||
const mediaType = headersNormalized.get('content-type'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I've seen how you did this, I like that it's inside validateInputIfBodySpecIsProvided()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
samesies! 🙌 Nice work!
return E.right(body); | ||
} | ||
|
||
const mediaType = headersNormalized.get('content-type'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
samesies! 🙌 Nice work!
thanks for the fix. Could it be that with this an empty PSOT request body doesn't trigger exception when a body payload is required? In my case I somehow can't get an exception triggered on missing body...!? I quick drafted a potential test case here:
|
Addresses #1939
Summary
inspects the request content-length header for making the decision to enforce the content-type on the request. if it is >1 then the content-type header must be one of the request body types.
Checklist