echo icon indicating copy to clipboard operation
echo copied to clipboard

Add handling for empty content type in request header

Open Calgorr opened this issue 2 years ago • 2 comments

Updated the code to handle the scenario when the content type in the request header is an empty string. Added a custom error to handle this scenario. No changes were made to other parts of the code.

Calgorr avatar Apr 14 '23 06:04 Calgorr

so i was trying to build a rest api with echo and i did not know that i should set the Content-Type header in the http request so i was getting this error (unsupported media type) which was kind of misleading me as i was consistently changing the http body but the problem was that i did not know that i should include the Content-Type header so after one hour i finally figured it out that i should set this header

by this little change hopefully no one gets stuck on the same problem that i got stuck on

Calgorr avatar Apr 14 '23 08:04 Calgorr

@aldas as you said it was not okay to return an error with 500 code as it was clients problem to set the content header so i fixed the problem and i added a test for this error

Calgorr avatar Apr 18 '23 05:04 Calgorr