Google Volley ignores POST-Parameter

前端 未结 5 1041
情书的邮戳
情书的邮戳 2020-12-18 08:32

I\'m currently trying to send a simple POST-request via Google Volley to my server. Therefore I\'ve written the following lines of code:

Map

        
5条回答
  •  情话喂你
    2020-12-18 09:09

    EDIT:

    I deleted my previous answer since it wasn't accurate.

    I'll go over what I know today: Apparently, getParams should work. But it doesn't always. I have debugged it myself, and it seems that it is being called when performing a PUT or POST request, and the params provided in that method are in a regular GET parameters string (?param1=value1¶m2=value2...) and encoded and put in the body.

    I don't know why but for some reason this doesn't work for some servers.

    The best alternate way I know to send parameters, is to put your parameters in a JSONObject and encode its contents in the request's body, using the request constructor.

提交回复
热议问题