The error information is as follows:
{ "timestamp": "2018-12-06T01:37:11.184+0000", "status": 415, "error": "Unsupported Media Type", "message": "Content type 'text/plain;charset=UTF-8' not supported", "path": "/testgu/ycyzharry" }
Cause of problem:
Media type refers to Internet media type, Internet media type, also known as MIME type. In the HTTP protocol message header, content type is used to represent the media type information in the specific request
for example: content type: text/HTML; charset:utf-8;
common media format types are as follows:
text/html :HTML format text/plain : Plain text format text/xml : XML format image/gif : gif image format image/jpeg : jpg image format image/png : png image format
Media format type starting with application:
application/xhtml+xml : XHTML format application/xml : XML data format application/atom+xml : Atom XML aggregation format application/json : JSON data format application/pdf : pdf format application/msword : Word document format application/octet-stream : Binary stream data (e.g. common file downloads) application/x-www-form-urlencoded : <form encType=""> in the default encType, form form data is encoded as key/value format and sent to the server (the default form submission format of the data)
Another common media format is used when uploading files:
multipart/form-data : This format is used when file uploads are required in the form
The above is the content format of content type we often use. The message message in this example indicates that the post request does not support the “text/plain” plain text format type
Solution: select the “application/JSON” JSON data format type to send the post request, and the interface return value is successfully obtained
Similar Posts:
- Spring MVC upload file error string cannot be converted to multipartfile
- CSRF verification failed. Request aborted [How to Solve]
- [Solved] Content type ‘application/x-www-form-urlencoded;charset=UTF-8’ not supported
- Jemter Error: {“type”:”https://tools.ietf.org/html/rfc7231#section-6.5.13″,”title”:”Unsupported Media Type”,”status”:415,”traceId”:”00-d0eeccb9ae68f44798713724724a4353-4623dc713e44b34c-00″
- Document.body.clientheight cannot get the browser page height correctly
- How to Solve Curl pass large JSON files Error
- The endpoint reference (EPR) for the operation not found possible problems and Solutions
- Uncaught typeerror: the solution of illegal invocation problem
- Interface automation (8): an error is reported during interface testing sslerror: Certificate verify failed