[英]Made sure content-type and content-encoding, still get 415 Unsupported media type
In my application, I am sending request with okhttp3 and retrofit2 .在我的应用程序中,我使用okhttp3和retrofit2发送请求。 Here is I logged the request by
HttpLoggingInterceptor
:这是我通过
HttpLoggingInterceptor
记录的请求:
okhttp3.OkHttpClient: --> POST https://something/here http/1.1
okhttp3.OkHttpClient: Content-Type: application/json; charset=UTF-8
okhttp3.OkHttpClient: Content-Length: 2596
okhttp3.OkHttpClient: --> END POST (2596-byte body)
And I have this in my server:我的服务器中有这个:
@Consumes("application/json; charset=UTF-8")
Currently, Keep getting HTTP 415 error code.目前,不断收到 HTTP 415 错误代码。
Environment:环境:
Not only the @Produce type should match the @Consumes type, but also the @Body should be completely matched.不仅@Produce 类型应该匹配@Consumes 类型,@Body 也应该完全匹配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.