Package com.jcabi.http.mock
Class MkAnswer.Simple
- java.lang.Object
-
- com.jcabi.http.mock.MkAnswer.Simple
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jcabi.http.mock.MkAnswer
MkAnswer.Simple
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringbody()HTTP response body.byte[]bodyBytes()HTTP response body as bytes.Map<String,List<String>>headers()HTTP response headers.intstatus()HTTP response status.StringtoString()MkAnswer.SimplewithBody(byte[] body)Make a copy of this answer, with another body.MkAnswer.SimplewithBody(String body)Make a copy of this answer, with another body.MkAnswer.SimplewithHeader(String name, String value)Make a copy of this answer, with an extra header.MkAnswer.SimplewithStatus(int status)Make a copy of this answer, with another status code.
-
-
-
Constructor Detail
-
Simple
public Simple(String body)
Public ctor.- Parameters:
body- Body of HTTP response
-
Simple
public Simple(int status)
Public ctor (with empty HTTP body).- Parameters:
status- HTTP status- Since:
- 1.9
-
Simple
public Simple(int status, String body)Public ctor.- Parameters:
status- HTTP statusbody- Body of HTTP response
-
-
Method Detail
-
status
public int status()
Description copied from interface:MkAnswerHTTP response status.
-
headers
public Map<String,List<String>> headers()
Description copied from interface:MkAnswerHTTP response headers.
-
bodyBytes
public byte[] bodyBytes()
Description copied from interface:MkAnswerHTTP response body as bytes.
-
withHeader
public MkAnswer.Simple withHeader(String name, String value)
Make a copy of this answer, with an extra header.- Parameters:
name- Name of the headervalue- ImmutableHeader value- Returns:
- New answer
-
withStatus
public MkAnswer.Simple withStatus(int status)
Make a copy of this answer, with another status code.- Parameters:
status- Status code- Returns:
- New answer
-
withBody
public MkAnswer.Simple withBody(String body)
Make a copy of this answer, with another body.- Parameters:
body- Body- Returns:
- New answer
-
withBody
public MkAnswer.Simple withBody(byte[] body)
Make a copy of this answer, with another body.- Parameters:
body- Body- Returns:
- New answer
-
-