public PostRequest addHeader(String key, String value) { if (headers == null) { headers = new Headers.Builder(); } headers.add(key, value); return this; }
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()); }
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()); }
/** * 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; }
/** * 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; }
/** * Sets the cache control header to private. * * @return this */ public Builder priv() { mHeaders.add(CACHE_CONTROL, "private"); return this; }
@Override protected Headers.Builder headersBuilder() { Headers.Builder builder = super.headersBuilder(); builder.add("Host", HOST); return builder; }