public final class ClientDriverResponse extends Object
| Constructor and Description |
|---|
ClientDriverResponse()
Creates a new response with an empty body, a status code of 204 and
no Content-Type.
|
ClientDriverResponse(InputStream content,
String contentType)
Creates a new response with the given body, a suitable default status
code and a given content-type.
|
ClientDriverResponse(String content)
Deprecated.
Use
ClientDriverResponse(String, String) instead. |
ClientDriverResponse(String content,
String contentType)
Creates a new response with the given body, a suitable default status
code and a given content-type.
|
| Modifier and Type | Method and Description |
|---|---|
ClientDriverResponse |
after(long delay,
TimeUnit timeUnit)
Modifies a ClientDriverRequest to specify some time to wait before
responding.
|
boolean |
canExpire() |
String |
getContent() |
byte[] |
getContentAsBytes() |
String |
getContentType() |
long |
getDelayTime() |
TimeUnit |
getDelayTimeUnit() |
Map<String,String> |
getHeaders() |
int |
getStatus() |
boolean |
hasBody() |
boolean |
hasNotExpired() |
ClientDriverResponse |
withContentType(String withContentType)
Deprecated.
You shouldn't need to use this method any more. Use one of
the creator methods which specifies a content-type.
|
ClientDriverResponse |
withHeader(String name,
String value)
Set headers on the response.
|
ClientDriverResponse |
within(long interval,
TimeUnit unit)
Sets the amount of time to allow this response to match within.
|
ClientDriverResponse |
withStatus(int withStatus) |
public ClientDriverResponse()
@Deprecated public ClientDriverResponse(String content)
ClientDriverResponse(String, String) instead.Creates a new response with the given body, a suitable default status code and a Content-Type of 'text/plain'.
If the content given is null a 204 status code is given, otherwise 200.
content - The content of the responsepublic ClientDriverResponse(String content, String contentType)
Creates a new response with the given body, a suitable default status code and a given content-type.
If the content given is null a 204 status code is given, otherwise 200.
content - The content of the responsecontentType - The content typepublic ClientDriverResponse(InputStream content, String contentType)
Creates a new response with the given body, a suitable default status code and a given content-type.
If the content given is null a 204 status code is given, otherwise 200.
content - The content of the responsecontentType - The content typepublic byte[] getContentAsBytes()
public String getContent()
public ClientDriverResponse withStatus(int withStatus)
withStatus - the status to setpublic ClientDriverResponse after(long delay, TimeUnit timeUnit)
delay - How long to delay for.timeUnit - The time unit to use when counting the delay.public long getDelayTime()
public TimeUnit getDelayTimeUnit()
public boolean canExpire()
public boolean hasNotExpired()
public int getStatus()
public String getContentType()
@Deprecated public ClientDriverResponse withContentType(String withContentType)
withContentType - the contentType to setpublic ClientDriverResponse withHeader(String name, String value)
name - The header namevalue - The header valuepublic ClientDriverResponse within(long interval, TimeUnit unit)
interval - The number of given unit to waitunit - The unit to wait forpublic boolean hasBody()
Copyright © 2016. All Rights Reserved.