I’m coding a new project in .NET Core Web API. (Dotnet Version: 2.2.401)
I decided that If there is something wrong in the Web API, I can show them (the visitors) “What happened in Web API” in response body. But first, I have to set up global exception things in my project.
Ok.. I did it! I gave them a message in response body.
In sometimes this is not good way If you creating a web api project. You can add to response headers. (I think you must do it)
So, I tried to add same message in response headers and It happened.. Crash..
Because, my error message was containing non ascii characters. (Thanks stackflowover.com)
My message was “Login olamıyor mk.”
When I using Postman app (Postman is a tool used to send requests), It seems like there is an issue. Because body and header is empty.
Finally, I found the solution. The response body was working, headers not working because of non ascii characters issue. I decided that the message of customize header must be base64 in response header.
Ok guys, It’s working and I have to write some code!