com.braintreepayments.http.Headers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of braintreehttp Show documentation
Show all versions of braintreehttp Show documentation
This is Braintree's generic http library for generated SDKs
package com.braintreepayments.http;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class Headers implements Iterable {
public static final String CONTENT_TYPE = "Content-Type";
public static final String AUTHORIZATION = "Authorization";
public static final String USER_AGENT = "User-Agent";
public static final String ACCEPT_ENCODING = "Accept-Encoding";
@Override
public Iterator iterator() {
return mHeaders.keySet().iterator();
}
protected Map mHeaders = new HashMap();
public Headers header(String header, String value) {
mHeaders.put(header, value);
return this;
}
public Headers headerIfNotPresent(String key, String value) {
if (header(key) == null) {
return header(key, value);
}
return this;
}
public Headers remove(String key) {
mHeaders.remove(key);
return this;
}
public String header(String key) {
return mHeaders.get(key);
}
}