Home > OS >  GET request with Query as object
GET request with Query as object

Time:12-02

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!

CodePudding user response:

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

  • Related