Q:

Retrofit. POST with request body without response body

I try to POST these login and password
{
    "userLogin": "Mark",
    "userPassword": "Pencil"
}

According to POSTMAN, where I put above JSON as a raw code, I got an empty response body and response code: 200 (Logging is succesful). But I can't achieve it in Android Studio. Here is an API interface
interface LoginService {
    @POST("login")
    fun userLogin(
        @Query("userLogin") userLogin: String,
        @Query("userPassword") userPassword: String
    ):Call<Void>
}

And here is Retrofit:
fun checkLoginData() {
        val retrofit = Retrofit.Builder()
            .baseUrl("myurl...")
            .addConverterFactory(GsonConverterFactory.create())
            .build()
        val service = retrofit.create(LoginService::class.java)
        val call = service.userLogin("Mark", "Pencil")

        call.enqueue(object : Callback<Void>{
            override fun onResponse(call: Call<Void>, response: Response<Void>) {
            if(response.code() == 200){
                Toast.makeText(applicationContext,"Logged in", Toast.LENGTH_SHORT).show()

            }
        }

            override fun onFailure(call: Call<Void>, t: Throwable) {
            Toast.makeText(applicationContext,"Error", Toast.LENGTH_SHORT).show()
        }

    })
}

I suppose that my LoginService is created incorrectly because there is always onFailure response. How should I do it rightly?

A:

Using POST you'll probably not use @Query, but rather a @Body. E.g.
data class LoginRequest(
val userLogin: String,
val userPassword: String
)

and in your interface :
 @POST("login")
    fun userLogin(@Body request: LoginRequest):Call<Void>

EDIT:
Since it's an issue with ClearText:
You need to add android:usesCleartextTraffic="true" to your AndroidManifest.
Refer to 
Android 8: Cleartext HTTP traffic not permitted
Option 2 for more info.

