Volley not calling getParams() for standard POST request

后端 未结 11 955
执念已碎
执念已碎 2020-11-30 07:56

I am trying to post some parameters to my rails API using Volley in Android. This is the code:

I tried with two log statements, one in getParams() and

11条回答
  •  感情败类
    2020-11-30 08:39

    For JSONobjectRequest the getParams() doesn’t work for POST requests so you have to make a customRequest and override getParams() method over there. Its because JsonObjectRequest is extended JsonRequest which overrides getBody() method directly, so your getParam() would never invoke. To invoke your getParams() method you first have to override getBody(). Or for a simple solution you can use StringRequest.

提交回复
热议问题