com.jayway.restassured.response
Class Headers

java.lang.Object
  extended by com.jayway.restassured.response.Headers
All Implemented Interfaces:
Iterable<Header>

public class Headers
extends Object
implements Iterable<Header>

Represents the a number of response headers


Constructor Summary
Headers(Header... headers)
           
Headers(List<Header> headers)
           
 
Method Summary
 boolean exist()
           
 Header get(String headerName)
          Get a single header with the supplied name.
 List<Header> getList(String headerName)
          Get all headers with the supplied name.
 String getValue(String headerName)
          Get a single header with the supplied name.
 List<String> getValues(String headerName)
          Get all header values of the header with supplied name.
 boolean hasHeaderWithName(String headerName)
          See if a header with the given name exists
static Headers headers(Header header, Header... additionalHeaders)
          An alternative way to create a Headers object from the constructor.
 Iterator<Header> iterator()
           
protected  List<Header> list()
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Headers

public Headers(Header... headers)

Headers

public Headers(List<Header> headers)
Method Detail

size

public int size()
Returns:
The size of the headers

exist

public boolean exist()
Returns:
true if one or more headers are defined, false otherwise.

hasHeaderWithName

public boolean hasHeaderWithName(String headerName)
See if a header with the given name exists

Parameters:
headerName - The name of the header to check
Returns:
true if the header exists

list

protected List<Header> list()
Returns:
All headers as a list.

get

public Header get(String headerName)
Get a single header with the supplied name. If there are several headers match the headerName then the first one is returned.

Parameters:
headerName - The name of the header to find
Returns:
The found header or null if no header was found.

getValue

public String getValue(String headerName)
Get a single header with the supplied name. If there are several headers match the headerName then the first one is returned.

Parameters:
headerName - The name of the header to find
Returns:
The found header value or null if no header was found.

getValues

public List<String> getValues(String headerName)
Get all header values of the header with supplied name. If there's only one header matching the headerName then a list with only that header value is returned.

Parameters:
headerName - The name of the header to find
Returns:
The found header values or empty list if no header was found.

getList

public List<Header> getList(String headerName)
Get all headers with the supplied name. If there's only one header matching the headerName then a list with only that header is returned.

Parameters:
headerName - The name of the header to find
Returns:
The found headers or empty list if no header was found.

iterator

public Iterator<Header> iterator()
Specified by:
iterator in interface Iterable<Header>
Returns:
Headers iterator

headers

public static Headers headers(Header header,
                              Header... additionalHeaders)
An alternative way to create a Headers object from the constructor.

Parameters:
header - The header to be included
additionalHeaders - Additional headers to be included (optional)
Returns:
A new headers object containing the specified headers

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010-2012. All Rights Reserved.