public class Headers extends Object
Constructor and Description |
---|
Headers() |
Headers(Collection<kong.unirest.Headers.Entry> entries) |
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
String value)
Add a header element
|
void |
add(String name,
java.util.function.Supplier<String> value)
Add a header element with a supplier which will be evaluated on request
|
List<Header> |
all()
Get all of the headers
|
void |
clear()
Clear the headers!
|
boolean |
containsKey(String name)
Check if a header is present
|
List<String> |
get(String name)
Get all the values for a header name
|
String |
getFirst(String key)
Get the first header value for a name
|
void |
putAll(Headers header)
Add a bunch of headers at once
|
void |
replace(String name,
String value)
Replace a header value.
|
int |
size()
Get the number of header keys.
|
public Headers()
public Headers(Collection<kong.unirest.Headers.Entry> entries)
public void add(String name, String value)
name
- the name of the headervalue
- the value for the headerpublic void add(String name, java.util.function.Supplier<String> value)
name
- the name of the headervalue
- the value for the headerpublic void replace(String name, String value)
name
- the name of the headervalue
- the value for the headerpublic int size()
public List<String> get(String name)
name
- name of the header elementpublic void putAll(Headers header)
header
- a headerpublic boolean containsKey(String name)
name
- a headerpublic void clear()
public String getFirst(String key)
key
- the name of the headerCopyright © 2019. All rights reserved.