Esempio n. 1
0
 public PostRequest addHeader(String key, String value) {
   if (headers == null) {
     headers = new Headers.Builder();
   }
   headers.add(key, value);
   return this;
 }
Esempio n. 2
0
  private static void appendHeaders(Request.Builder builder, Map<String, String> headers) {
    Headers.Builder headerBuilder = new Headers.Builder();
    if (headers == null || headers.isEmpty()) return;

    for (String key : headers.keySet()) {
      headerBuilder.add(key, headers.get(key));
    }
    builder.headers(headerBuilder.build());
  }
Esempio n. 3
0
  protected void appendHeaders() {
    Headers.Builder headerBuilder = new Headers.Builder();
    if (headers == null || headers.isEmpty()) return;

    for (String key : headers.keySet()) {
      headerBuilder.add(key, headers.get(key));
    }
    builder.headers(headerBuilder.build());
  }
Esempio n. 4
0
 /**
  * Adds the value for the header with the specified name. It doesn't replaces any previous value
  * set for the same header name.
  *
  * @param name the header name.
  * @param value the header value.
  * @return this
  */
 public Builder addHeader(final String name, final String value) {
   mHeaders.add(name, value);
   return this;
 }
Esempio n. 5
0
 /**
  * Sets the cache control max-age value.
  *
  * @param secs the max-age value in seconds.
  * @return this
  */
 public Builder maxAge(final long secs) {
   mHeaders.add(CACHE_CONTROL, "max-age=" + secs);
   return this;
 }
Esempio n. 6
0
 /**
  * Sets the cache control header to private.
  *
  * @return this
  */
 public Builder priv() {
   mHeaders.add(CACHE_CONTROL, "private");
   return this;
 }
Esempio n. 7
0
 @Override
 protected Headers.Builder headersBuilder() {
   Headers.Builder builder = super.headersBuilder();
   builder.add("Host", HOST);
   return builder;
 }