Package kong.unirest.core
Class Headers
java.lang.Object
kong.unirest.core.Headers
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Add a header elementvoid
Add a header element with a supplier which will be evaluated on requestvoid
all()
Get all of the headersvoid
clear()
Clear the headers!boolean
containsKey
(String name) Check if a header is presentvoid
cookie
(Collection<Cookie> cookies) void
boolean
Get all the values for a header nameGet the first header value for a nameint
hashCode()
private boolean
void
Add a bunch of headers at oncevoid
Remove a header by name(package private) void
void
Replace a header value.void
Replace all headers from a given map.void
setBasicAuth
(String username, String password) int
size()
Get the number of header keys.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
headers
-
-
Constructor Details
-
Headers
public Headers() -
Headers
-
-
Method Details
-
add
Add a header element- Parameters:
name
- the name of the headervalue
- the value for the header
-
add
Add a header element with a supplier which will be evaluated on request- Parameters:
name
- the name of the headervalue
- the value for the header
-
replace
Replace a header value. If there are multiple instances it will overwrite all of them- Parameters:
name
- the name of the headervalue
- the value for the header
-
remove
Remove a header by name- Parameters:
name
- the name of the header
-
size
public int size()Get the number of header keys.- Returns:
- the size of the header keys
-
get
Get all the values for a header name- Parameters:
name
- name of the header element- Returns:
- a list of values
-
putAll
Add a bunch of headers at once- Parameters:
header
- a header
-
containsKey
Check if a header is present- Parameters:
name
- a header- Returns:
- if the headers contain this name.
-
clear
public void clear()Clear the headers! -
getFirst
Get the first header value for a name- Parameters:
key
- the name of the header- Returns:
- the first value
-
all
Get all of the headers- Returns:
- all the headers, in order
-
isName
-
remove
-
toString
-
cookie
-
cookie
-
equals
-
hashCode
public int hashCode() -
setBasicAuth
-
accepts
-
add
-
replace
Replace all headers from a given map.- Parameters:
headerMap
- the map of headers
-