What is “406-Not Acceptable Response” in HTTP?

后端 未结 9 1960
礼貌的吻别
礼貌的吻别 2020-11-22 08:20

In my Ruby on Rails application I tried to upload an image through the POSTMAN REST client in Base64 format. When I POST the image I am getting a 406 Not Acceptable Resp

9条回答
  •  余生分开走
    2020-11-22 08:46

    In my case for a API in .NET-Core, the api is set to work with XML (by default is set to response with JSON), so I add this annotation in my Controller :

    [Produces("application/xml")]
    public class MyController : ControllerBase {...}
    

    Thank you for putting me on the path !

提交回复
热议问题