Android Volley gives me 400 error

后端 未结 12 2154
借酒劲吻你
借酒劲吻你 2020-12-11 00:28

I\'m trying to make a POST request to my API and it works in Postman (I get a valid JSON object), but not using Volley. With the follo

12条回答
  •  北荒
    北荒 (楼主)
    2020-12-11 01:11

    There can be multiple reasons for this error.

    One reason, of course, as said by others, is that maybe you are missing or have improperly set 'Content-type' header.

    If you have properly implemented that, another possible reason is that you are sending params directly from your URL. There may be a case when params is a string with some white spaces in it. These white spaces cause problems in GET requests through Volley. You need to find another way around it. That's all.

提交回复
热议问题