0

I need to make @GET request with parameters likes this:

@GET("some_url")
suspend fun getSomething(
@Query("simpleString") someString: String,
@Query("objectThatINeedToPass") someObject: SomeDataObjectForGetRequest
): List<BackendObject>

If i'll use @Body instead of @Query than Android Studio throws exception like this: "..... @Body used with non-body request"

Please help me!

  • 1
    GET requests usually don't have a body. maybe Retrofit disallows it. see also https://stackoverflow.com/questions/978061/http-get-with-request-body – Ivo Dec 01 '21 at 12:04
  • 1
    refer https://stackoverflow.com/questions/58026072/how-to-send-request-body-in-get-method-retrofit – sasikumar Dec 01 '21 at 12:22

1 Answers1

1

GET requests don't have a request body, you should use POST if you send a body

Per.J
  • 1,229
  • 8
  • 12