Java 类retrofit2.http.HeaderMap 实例源码

项目:GitHub    文件:RequestBuilderTest.java   
@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");
  }
}
项目:GitHub    文件:RequestBuilderTest.java   
@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.");
  }
}
项目:GitHub    文件:RequestBuilderTest.java   
@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");
  }
}
项目:GitHub    文件:RequestBuilderTest.java   
@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.");
  }
}
项目:EvolvingNetLib    文件:CCNetApiService.java   
/**
 * 上传文件
 * @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
);
项目:EvolvingNetLib    文件:CCNetApiService.java   
/**
 * 下载文件
 * @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
);
项目:retrofit-OurRetrofit    文件:HttpUtil.java   
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;
}
项目:retrofit-OurRetrofit    文件:HttpUtil.java   
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;
}
项目:maoni-doorbell    文件:DoorbellService.java   
@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);
项目:maoni-doorbell    文件:DoorbellService.java   
@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);
项目:maoni-doorbell    文件:DoorbellService.java   
@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);
项目:TestChat    文件:ApiService.java   
@Streaming
@GET
Call<ResponseBody> download(@Url String url, @HeaderMap Map<String,String> headerMap);
项目:filestack-java    文件:UploadService.java   
@PUT
Call<ResponseBody> uploadS3(
    @HeaderMap Map<String, String> headers,
    @Url String url,
    @Body RequestBody body);
项目:Auto.js    文件:UserApi.java   
@FormUrlEncoded
@POST("/login")
Observable<ResponseBody> login(@HeaderMap Map<String, String> csrfToken, @Field("username") String userName, @Field("password") String password);
项目:Auto.js    文件:UserApi.java   
@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);
项目:Auto.js    文件:UserApi.java   
@POST("/logout")
Observable<ResponseBody> logout(@HeaderMap Map<String, String> csrfToken);
项目:AndroidRequest    文件:RetrofitHttpService.java   
@GET()
Call<String> get(@HeaderMap Map<String, String> headers, @Url String url, @QueryMap Map<String, String> params);
项目:AndroidRequest    文件:RetrofitHttpService.java   
@FormUrlEncoded
@POST()
Call<String> post(@HeaderMap Map<String, String> headers, @Url String url, @FieldMap Map<String, String> params);
项目:AndroidRequest    文件:RetrofitHttpService.java   
@GET()
Observable<String> Obget(@HeaderMap Map<String, String> headers, @Url String url, @QueryMap Map<String, String> params);
项目:AndroidRequest    文件:RetrofitHttpService.java   
@FormUrlEncoded
@POST()
Observable<String> Obpost(@HeaderMap Map<String, String> headers, @Url String url, @FieldMap Map<String, String> params);
项目:AndroidRequest    文件:RetrofitHttpService.java   
@Streaming
@GET()
Observable<ResponseBody> Obdownload(@HeaderMap Map<String, String> headers, @Url String url, @QueryMap Map<String, String> params);
项目:AndroidRequest    文件:RetrofitHttpService.java   
@Streaming
@GET()
Call<ResponseBody> download(@HeaderMap Map<String, String> headers, @Url String url, @QueryMap Map<String, String> params);
项目:retrofit-OurRetrofit    文件:HttpUtil.java   
@GET
Call<ResponseBody> get(@Url String url, @HeaderMap Map<String, String> headers, @QueryMap Map<String, Object> param);
项目:retrofit-OurRetrofit    文件:HttpUtil.java   
@FormUrlEncoded
@POST
Call<ResponseBody> post(@Url String url, @HeaderMap Map<String, String> headers, @FieldMap Map<String, Object> param);
项目:AvenueNet    文件:ClientService.java   
@GET
Observable<String> get(@Url String url, @QueryMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
项目:AvenueNet    文件:ClientService.java   
@FormUrlEncoded
@POST
Observable<String> post(@Url String url, @FieldMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
项目:AvenueNet    文件:ClientService.java   
@POST
Observable<String> postRaw(@Url String url, @Body RequestBody body, @HeaderMap Map<String, Object> header);
项目:AvenueNet    文件:ClientService.java   
@FormUrlEncoded
@PUT
Observable<String> put(@Url String url, @FieldMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
项目:AvenueNet    文件:ClientService.java   
@PUT
Observable<String> putRaw(@Url String url, @Body RequestBody body, @HeaderMap Map<String, Object> header);
项目:AvenueNet    文件:ClientService.java   
@DELETE
Observable<String> delete(@Url String url, @QueryMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
项目:AvenueNet    文件:ClientService.java   
@Streaming
@GET
Observable<ResponseBody> download(@Url String url, @QueryMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
项目:AvenueNet    文件:ClientService.java   
@Multipart
@POST
Observable<String> upload(@Url String url, @Part MultipartBody.Part file, @HeaderMap Map<String, Object> header);
项目:AvenueNet    文件:ClientService.java   
@Multipart
@POST
Observable<String> upload(@Url String url, @PartMap Map<String, MultipartBody.Part> files, @HeaderMap Map<String, Object> header);
项目:AvenueNet    文件:ClientService.java   
@Multipart
@POST
Observable<String> upload(@Url String url, @PartMap Map<String, RequestBody> params, @Part MultipartBody.Part file, @HeaderMap Map<String, Object> header);
项目:AvenueNet    文件:ClientService.java   
@Multipart
@POST
Observable<String> upload(@Url String url, @PartMap Map<String, RequestBody> params, @PartMap Map<String, MultipartBody.Part> files, @HeaderMap Map<String, Object> header);
项目:dice    文件:HotbitsService.java   
@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);
项目:dice    文件:AnuQuantumService.java   
@Headers({"DNT: 1"})
@GET("/API/jsonI.php?length=1&type=hex16")
Call<AnuQuantumResponse> getRandom(@HeaderMap Map<String, String> headers, @Query("size") int byteLength);
项目:dice    文件:RandomOrgService.java   
@Headers({"DNT: 1"})
@POST("/json-rpc/1/invoke")
Call<String> getRandom(@HeaderMap Map<String, String> headers, @Body RandomOrgBlobRequest request);
项目:ImageClassify    文件:ResetPasswordService.java   
@FormUrlEncoded
@POST("send")
Call<SMSVerifyResponse> getVerifyCode(@HeaderMap Map<String, String> headers,
                                      @Field(ApiConstant.MOBILE) String mobile,
                                      @Field(ApiConstant.TEMPLATE_ID) String templateid);
项目:ImageClassify    文件:ResetPasswordService.java   
@FormUrlEncoded
@POST("verifycode.action")
Call<ResponseBody> checkVerifyCode(@HeaderMap Map<String, String> headers,
                                   @Field(ApiConstant.MOBILE) String mobile,
                                   @Field(ApiConstant.CODE) String code);