skip to Main Content

To send the header to the server in Kathleen language with Retrofit library, I use the following form

But the header is not sent

@POST("testPost.php")
fun postNews(@Query("txt") txt:String) : Single<List<News>>

2

Answers


  1. The example you shared is not attaching any headers to the request. Check out the "Header Manipulation" chapter of Retrofit’s documentation page to learn how to add headers.

    Login or Signup to reply.
  2. You Can try this :

    @Headers({
       "Accept: application/vnd.github.v3.full+json",
       "User-Agent: Retrofit-Sample-App"
    })
    @GET("users/{username}")
    Call<User> getUser(@Path("username") String username);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search