Reputation: 459
Hello I have used custom method in my code as below but it always gives me
java.lang.IllegalArgumentException: method AUTH must not have a request body.
My code is not working it always says: Custom method AUTH, must not have a Body
@Headers("Content-Type: application/json")
@HTTP(method = "AUTH", path = "login/{deviceId}", hasBody = true)
Call<Success> getLogin( @Path("deviceId") int deviceId, @Body RequestBody password);
I am using below dependancies.
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
Can you please help me.
Upvotes: 2
Views: 4183
Reputation: 650
I had the same issue and after searching into the documentation, I found that the problem was retrofit
version, try using version 2.4.0
or higher.
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
Upvotes: 6