HTTP GET with request body RETROFIT

前端 未结 5 2053
轻奢々
轻奢々 2021-02-06 23:45

I am using Retrofit to make api calls in my android application. I have to submit a @Body of JSON

@GET(\"api/\")
void getData(@Body UserPostRequestBody request)
         


        
5条回答
  •  眼角桃花
    2021-02-07 00:01

    If the request body you need to send is not to complex you can also specify the query parametters as https://myserverdomain.com?somebody[property1]=value specifically on retrofit you define it like this:

    Observable> someMethod(@Query("somebody[property1]") int property1);
    

    that will work at least if you are requesting to a rails server hope this answer helps somebody

提交回复
热议问题