排球发布请求415错误

时间:2015-04-01 05:14:06

标签: android json http-headers android-volley

使用volley的POSt请求的API响应给出了415错误 - 请求Content-Type:Expected'application / json'有问题。

问题不在于API,因为如果我们不使用Volley或使用浏览器休息客户端,我们会得到适当的响应。

这是使用的代码

 VolleyRequestManager<test> volleyRequestManager =
            new VolleyRequestManager<>(Request.Method.POST, url,    requestBody, test.class,
                    Utility.getBearerAuthHeader(context.getApplicationContext(),
                            Constants.RequestKey.CONTENT_TYPE_APPLICATION_JSON), listener, errorListener
            );

    VolleyRequestQueue.getInstance(context.getApplicationContext())
            .addToRequestQueue(volleyRequestManager, tag);

对于请求主体参数,创建了Jsonobject并将所有值添加到此并将其转换为字符串

  JSONObject params = new JSONObject();  
  params.toString()

请帮忙。

0 个答案:

没有答案
相关问题