3

I am currently using .NET8 and Minimal API to handle requests. Everything works perfectly when a request has a header with the value Content-Type: application/json. However, when the 'Content-Type' is set to 'text/json', the API returns an HTTP code 415 error.

I am wondering how I can configure my Minimal API to accept requests with the 'Content-Type' set to 'text/json'?"

1 Answer 1

4

To resolve this issue we should use .Accepts(typeof(Something), "text/json") after .MapPost or .MapXXX method.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.