Search code examples
javaandroidkotlinretrofit2

How can I fix the error in Retrofit 2? I have an error sending a request


I don't understand where the error is. My project has REGISTER section. I need to get the email and send it to AuthService.

This image shows the error:

This is my AuthService:

This is a sample request from Postman:


Solution

  • As the exception message said :

    for dynamic query parameters use @Query

    @Path is used for replacing a URL path segment, not for adding query parameters.

    Your function should be something like this:

    @GET("/auth/send-email")
    fun sendEmail(@Query("email") email: String)