P粉4550931232023-08-26 10:02:04
Typically, HTTP response status code 415 tells you that the data you sent is in a format that the server does not accept, as briefly described here: here.
So to solve the problem you need to find out the format the server expects to receive the data in, and send it in that format. The easiest way is to check your server's documentation (or ask the developer).
If you examine the raw response returned by the browser (or perform the same request via a tool like cURL or Postman), you may find some clues there about the formats accepted by the endpoint or the specific issue causing the incorrect response.
Of course, this requires the developer of the server to implement HTTP status codes correctly, and they may have made a mistake. As a complete guess, given that you set the Accept
header, the server is probably trying to tell you that it can't give you a response in the "application/json-patch json" format, although that should give you a 406 .