There is a service written in golang, using gin-gonic framework.
I only ever want to support application/json
as a mime-type and it would be great if it always be in UTF-8. The business logic of the service might break if it will get values in different encodings.
Is it a good idea to write a custom middleware that checks if Content-Type
header has value "application/json; charset=utf-8"
and returns some 4xx status in case it is not?
UPDATE:
Just found out that ctx.ContentType() doesn't return charset
part of the header. Is there a way to get it?