retrofit / retrofit2.http / HeaderMap

HeaderMap

@Target([AnnotationTarget.VALUE_PARAMETER]) class HeaderMap

Adds headers specified in the Map or okhttp3.Headers.

Values in the map are converted to strings using Retrofit#stringConverter(Type, * Annotation[]) (or Object#toString(), if no matching string converter is installed).

Simple Example:


  @GET("/search")
  void list(@HeaderMap Map<String, String> headers);
 
  ...
 
  // The following call yields /search with headers
  // Accept: text/plain and Accept-Charset: utf-8
  foo.list(ImmutableMap.of("Accept", "text/plain", "Accept-Charset", "utf-8"));
  

See Also
HeaderHeaders

Constructors

<init>

HeaderMap()

Adds headers specified in the Map or okhttp3.Headers.