Java Code Examples for retrofit2.http.HeaderMap

The following are top voted examples for showing how to use retrofit2.http.HeaderMap. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: GitHub   File: RequestBuilderTest.java   View source code 5 votes vote down vote up
@Test public void headerMapMustBeAMap() {
  class Example {
    @GET("/")
    Call<ResponseBody> method(@HeaderMap List<String> headers) {
      return null;
    }
  }
  try {
    buildRequest(Example.class);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage(
        "@HeaderMap parameter type must be Map. (parameter #1)\n    for method Example.method");
  }
}
 
Example 2
Project: GitHub   File: RequestBuilderTest.java   View source code 5 votes vote down vote up
@Test public void headerMapRejectsNull() {
  class Example {
    @GET("/")
    Call<ResponseBody> method(@HeaderMap Map<String, String> headers) {
      return null;
    }
  }

  try {
    buildRequest(Example.class, (Map<String, String>) null);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage("Header map was null.");
  }
}
 
Example 3
Project: GitHub   File: RequestBuilderTest.java   View source code 5 votes vote down vote up
@Test public void headerMapMustBeAMap() {
  class Example {
    @GET("/")
    Call<ResponseBody> method(@HeaderMap List<String> headers) {
      return null;
    }
  }
  try {
    buildRequest(Example.class);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage(
        "@HeaderMap parameter type must be Map. (parameter #1)\n    for method Example.method");
  }
}
 
Example 4
Project: GitHub   File: RequestBuilderTest.java   View source code 5 votes vote down vote up
@Test public void headerMapRejectsNull() {
  class Example {
    @GET("/")
    Call<ResponseBody> method(@HeaderMap Map<String, String> headers) {
      return null;
    }
  }

  try {
    buildRequest(Example.class, (Map<String, String>) null);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage("Header map was null.");
  }
}
 
Example 5
Project: EvolvingNetLib   File: CCNetApiService.java   View source code 5 votes vote down vote up
/**
 * 上传文件
 * @param url
 * @param headerMap
 * @param paramPartList
 * @return
 */
@Multipart
@POST
Call<ResponseBody> executeUpload(
        @Url String url,
        @HeaderMap Map<String, String> headerMap,
        @Part() List<MultipartBody.Part> paramPartList
);
 
Example 6
Project: EvolvingNetLib   File: CCNetApiService.java   View source code 5 votes vote down vote up
/**
 * 下载文件
 * @param url
 * @param headerMap
 * @param txtParamMap
 * @return
 */
@Streaming
@GET
Call<ResponseBody> executeDownload(
        @Url String url,
        @HeaderMap Map<String, String> headerMap,
        @QueryMap Map<String, String> txtParamMap
);
 
Example 7
Project: retrofit-OurRetrofit   File: HttpUtil.java   View source code 5 votes vote down vote up
public static <T> Call getAsync(String apiUrl, @HeaderMap Map<String, Object> headers, Map<String, Object> paramMap, final HttpResponse<T> httpResponse) {
    if (paramMap == null) {
        paramMap = new HashMap<>();
    }
    if (headers == null) {
        headers = new HashMap<>();
    }
    HttpService httpService = getInstance().mRetrofit.create(HttpService.class);
    Call<ResponseBody> call = httpService.get(apiUrl, headers, paramMap);
    parseNetData(call, httpResponse);
    return call;
}
 
Example 8
Project: retrofit-OurRetrofit   File: HttpUtil.java   View source code 5 votes vote down vote up
public static <T> Call postAsync(String apiUrl, @HeaderMap Map<String, Object> headers, Map<String, Object> paramMap, HttpResponse<T> httpResponse) {
    if (paramMap == null) {
        paramMap = new HashMap<>();
    }
    if (headers == null) {
        headers = new HashMap<>();
    }
    HttpService httpService = getInstance().mRetrofit.create(HttpService.class);
    Call<ResponseBody> call = httpService.post(apiUrl, headers, paramMap);

    parseNetData(call, httpResponse);
    return call;
}
 
Example 9
Project: maoni-doorbell   File: DoorbellService.java   View source code 5 votes vote down vote up
@POST("applications/{id}/submit")
Call<ResponseBody> submitFeedbackForm(
        @HeaderMap final Map<String, String> httpHeaders,
        @Path("id") final int applicationId,
        @Query("key") final String key,
        @Query("email") final String email,
        @Query("message") final String message,
        @Query("name") final String userName,
        @Query("properties") final String propertiesJson,
        @Query("attachments[]") final String[] attachments);
 
Example 10
Project: maoni-doorbell   File: DoorbellService.java   View source code 5 votes vote down vote up
@Multipart
@POST("applications/{id}/upload")
Call<String[]> uploadScreenshot(
        @HeaderMap final Map<String, String> httpHeaders,
        @Path("id") final int applicationId,
        @Query("key") final String key,
        @Part("files[]\"; filename=\"screenshot.png\" ") final RequestBody filename);
 
Example 11
Project: maoni-doorbell   File: DoorbellService.java   View source code 5 votes vote down vote up
@Multipart
@POST("applications/{id}/upload")
Call<String[]> uploadLogs(
        @HeaderMap final Map<String, String> httpHeaders,
        @Path("id") final int applicationId,
        @Query("key") final String key,
        @Part("files[]\"; filename=\"logs.txt\" ") final RequestBody filename);
 
Example 12
Project: TestChat   File: ApiService.java   View source code 4 votes vote down vote up
@Streaming
@GET
Call<ResponseBody> download(@Url String url, @HeaderMap Map<String,String> headerMap);
 
Example 13
Project: filestack-java   File: UploadService.java   View source code 4 votes vote down vote up
@PUT
Call<ResponseBody> uploadS3(
    @HeaderMap Map<String, String> headers,
    @Url String url,
    @Body RequestBody body);
 
Example 14
Project: Auto.js   File: UserApi.java   View source code 4 votes vote down vote up
@FormUrlEncoded
@POST("/login")
Observable<ResponseBody> login(@HeaderMap Map<String, String> csrfToken, @Field("username") String userName, @Field("password") String password);
 
Example 15
Project: Auto.js   File: UserApi.java   View source code 4 votes vote down vote up
@FormUrlEncoded
@POST("/register")
Observable<ResponseBody> register(@HeaderMap Map<String, String> csrfToken, @Field("email") String email,
                                  @Field("username") String userName, @Field("password") String password, @Field("password-confirm") String repeatPassword);
 
Example 16
Project: Auto.js   File: UserApi.java   View source code 4 votes vote down vote up
@POST("/logout")
Observable<ResponseBody> logout(@HeaderMap Map<String, String> csrfToken);
 
Example 17
Project: AndroidRequest   File: RetrofitHttpService.java   View source code 4 votes vote down vote up
@GET()
Call<String> get(@HeaderMap Map<String, String> headers, @Url String url, @QueryMap Map<String, String> params);
 
Example 18
Project: AndroidRequest   File: RetrofitHttpService.java   View source code 4 votes vote down vote up
@FormUrlEncoded
@POST()
Call<String> post(@HeaderMap Map<String, String> headers, @Url String url, @FieldMap Map<String, String> params);
 
Example 19
Project: AndroidRequest   File: RetrofitHttpService.java   View source code 4 votes vote down vote up
@GET()
Observable<String> Obget(@HeaderMap Map<String, String> headers, @Url String url, @QueryMap Map<String, String> params);
 
Example 20
Project: AndroidRequest   File: RetrofitHttpService.java   View source code 4 votes vote down vote up
@FormUrlEncoded
@POST()
Observable<String> Obpost(@HeaderMap Map<String, String> headers, @Url String url, @FieldMap Map<String, String> params);
 
Example 21
Project: AndroidRequest   File: RetrofitHttpService.java   View source code 4 votes vote down vote up
@Streaming
@GET()
Observable<ResponseBody> Obdownload(@HeaderMap Map<String, String> headers, @Url String url, @QueryMap Map<String, String> params);
 
Example 22
Project: AndroidRequest   File: RetrofitHttpService.java   View source code 4 votes vote down vote up
@Streaming
@GET()
Call<ResponseBody> download(@HeaderMap Map<String, String> headers, @Url String url, @QueryMap Map<String, String> params);
 
Example 23
Project: retrofit-OurRetrofit   File: HttpUtil.java   View source code 4 votes vote down vote up
@GET
Call<ResponseBody> get(@Url String url, @HeaderMap Map<String, String> headers, @QueryMap Map<String, Object> param);
 
Example 24
Project: retrofit-OurRetrofit   File: HttpUtil.java   View source code 4 votes vote down vote up
@FormUrlEncoded
@POST
Call<ResponseBody> post(@Url String url, @HeaderMap Map<String, String> headers, @FieldMap Map<String, Object> param);
 
Example 25
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@GET
Observable<String> get(@Url String url, @QueryMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
 
Example 26
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@FormUrlEncoded
@POST
Observable<String> post(@Url String url, @FieldMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
 
Example 27
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@POST
Observable<String> postRaw(@Url String url, @Body RequestBody body, @HeaderMap Map<String, Object> header);
 
Example 28
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@FormUrlEncoded
@PUT
Observable<String> put(@Url String url, @FieldMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
 
Example 29
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@PUT
Observable<String> putRaw(@Url String url, @Body RequestBody body, @HeaderMap Map<String, Object> header);
 
Example 30
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@DELETE
Observable<String> delete(@Url String url, @QueryMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
 
Example 31
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@Streaming
@GET
Observable<ResponseBody> download(@Url String url, @QueryMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
 
Example 32
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@Multipart
@POST
Observable<String> upload(@Url String url, @Part MultipartBody.Part file, @HeaderMap Map<String, Object> header);
 
Example 33
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@Multipart
@POST
Observable<String> upload(@Url String url, @PartMap Map<String, MultipartBody.Part> files, @HeaderMap Map<String, Object> header);
 
Example 34
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@Multipart
@POST
Observable<String> upload(@Url String url, @PartMap Map<String, RequestBody> params, @Part MultipartBody.Part file, @HeaderMap Map<String, Object> header);
 
Example 35
Project: AvenueNet   File: ClientService.java   View source code 4 votes vote down vote up
@Multipart
@POST
Observable<String> upload(@Url String url, @PartMap Map<String, RequestBody> params, @PartMap Map<String, MultipartBody.Part> files, @HeaderMap Map<String, Object> header);
 
Example 36
Project: dice   File: HotbitsService.java   View source code 4 votes vote down vote up
@Headers({"DNT: 1"})
@GET("/cgi-bin/Hotbits?fmt=bin")
Call<ResponseBody> getRandom(@HeaderMap Map<String, String> headers, @Query("nbytes") int bitLength, @Query("apikey") String apiKey);
 
Example 37
Project: dice   File: AnuQuantumService.java   View source code 4 votes vote down vote up
@Headers({"DNT: 1"})
@GET("/API/jsonI.php?length=1&type=hex16")
Call<AnuQuantumResponse> getRandom(@HeaderMap Map<String, String> headers, @Query("size") int byteLength);
 
Example 38
Project: dice   File: RandomOrgService.java   View source code 4 votes vote down vote up
@Headers({"DNT: 1"})
@POST("/json-rpc/1/invoke")
Call<String> getRandom(@HeaderMap Map<String, String> headers, @Body RandomOrgBlobRequest request);
 
Example 39
Project: ImageClassify   File: ResetPasswordService.java   View source code 4 votes vote down vote up
@FormUrlEncoded
@POST("send")
Call<SMSVerifyResponse> getVerifyCode(@HeaderMap Map<String, String> headers,
                                      @Field(ApiConstant.MOBILE) String mobile,
                                      @Field(ApiConstant.TEMPLATE_ID) String templateid);
 
Example 40
Project: ImageClassify   File: ResetPasswordService.java   View source code 4 votes vote down vote up
@FormUrlEncoded
@POST("verifycode.action")
Call<ResponseBody> checkVerifyCode(@HeaderMap Map<String, String> headers,
                                   @Field(ApiConstant.MOBILE) String mobile,
                                   @Field(ApiConstant.CODE) String code);