You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
If the Content-Type: application/json header is missing or incorrect, the PayID server should return a 415 error Unsupported Media Type.
Actual Behavior
If a POST or PUT request is made without (or with an incorrect) Content-Type: application/json, the PayID returns a 400 Bad Request with the following message, despite having a correct payId field in the body:
{
"statusCode": 400,
"error": "Bad Request",
"message": "A `payId` must be provided in the request body."
}
Context
It can be misleading to see that a payId field is required even if it is present in the body.
The actual error doesn't describe what the real error is (an invalid Content-Type header).
Potential Solution
Let's use the new checkAdminApiContentTypeHeaders function in checkAdminApiHeaders.ts in the Admin routes.
Steps to Reproduce
Execute this cURL request which doesn't include Content-Type application/json:
Expected Behavior
If the
Content-Type: application/json
header is missing or incorrect, the PayID server should return a 415 errorUnsupported Media Type
.Actual Behavior
If a POST or PUT request is made without (or with an incorrect)
Content-Type: application/json
, the PayID returns a400
Bad Request with the following message, despite having a correctpayId
field in the body:Context
It can be misleading to see that a
payId
field is required even if it is present in the body.The actual error doesn't describe what the real error is (an invalid
Content-Type
header).Potential Solution
Let's use the new
checkAdminApiContentTypeHeaders
function incheckAdminApiHeaders.ts
in the Admin routes.Steps to Reproduce
Execute this cURL request which doesn't include
Content-Type application/json
:Environment
v13.8.0
6.14.5
MacOS Mojave 10.14.6
Latest
1.0
Screenshots
If applicable, add screenshots to help explain your problem.
Bonus
Are you willing to submit a pull request to fix this bug?
Yes
The text was updated successfully, but these errors were encountered: