public interface ResponseStubbing
Modifier and Type | Method and Description |
---|---|
ResponseStubbing |
thenRespond()
Starts a definition of a subsequent stub response.
|
ResponseStubbing |
withBody(byte[] responseBody)
Sets the stub http response body as an array of bytes.
|
ResponseStubbing |
withBody(InputStream is)
Sets the stub http response body as the content of the given input stream.
|
ResponseStubbing |
withBody(Reader reader)
Sets the stub http response body as the content of the given reader.
|
ResponseStubbing |
withBody(String responseBody)
Sets the stub http response body as a string.
|
ResponseStubbing |
withContentType(String contentType)
Sets the content type of the http stub response.
|
ResponseStubbing |
withDelay(long delayValue,
TimeUnit delayUnit)
Sets the response delay.
|
ResponseStubbing |
withEncoding(Charset encoding)
Sets the character encoding of the http stub response.
|
ResponseStubbing |
withHeader(String name,
String value)
Adds a stub http response header.
|
ResponseStubbing |
withStatus(int status)
Sets the http stub response status.
|
ResponseStubbing withContentType(String contentType)
contentType
- response content typeResponseStubbing withEncoding(Charset encoding)
Jadler.OngoingConfiguration.respondsWithDefaultEncoding(java.nio.charset.Charset)
).
Please note this method doesn't set the Content-Type header charset part,
withContentType(java.lang.String)
must be called to do so. You can even set different
stub response body encoding and Content-Type if your testing scenario requires it.encoding
- response body encodingResponseStubbing withStatus(int status)
Jadler.OngoingConfiguration.respondsWithDefaultStatus(int)
).status
- http status codeResponseStubbing withHeader(String name, String value)
name
- header namevalue
- header valueResponseStubbing withBody(String responseBody)
withEncoding(java.nio.charset.Charset)
Calling this method overrides any previous calls of this or any other withBody method.responseBody
- response bodyResponseStubbing withBody(Reader reader)
withEncoding(java.nio.charset.Charset)
Calling this method overrides any previous calls of this or any other withBody method.reader
- response body sourceResponseStubbing withBody(InputStream is)
withEncoding(java.nio.charset.Charset)
in any way.
Calling this method overrides any previous calls of this or any other withBody method.is
- response body sourceResponseStubbing withBody(byte[] responseBody)
withEncoding(java.nio.charset.Charset)
in any way.
Calling this method overrides any previous calls of this or any other withBody method.responseBody
- response bodyResponseStubbing withDelay(long delayValue, TimeUnit delayUnit)
delayValue
- a delay (in units defined by the delayUnit
parameter)
this stub response will be returned afterdelayUnit
- unit of the delay parameterResponseStubbing thenRespond()
Copyright © 2016. All Rights Reserved.