Package com.jcabi.http.mock
Class MkAnswer.Simple
java.lang.Object
com.jcabi.http.mock.MkAnswer.Simple
- All Implemented Interfaces:
MkAnswer
- Enclosing interface:
- MkAnswer
@Immutable
@Loggable(1)
public static final class MkAnswer.Simple
extends Object
implements MkAnswer
Simple implementation.
- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jcabi.http.mock.MkAnswer
MkAnswer.Simple -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbody()HTTP response body.byte[]HTTP response body as bytes.headers()HTTP response headers.intstatus()HTTP response status.toString()withBody(byte[] body) Make a copy of this answer, with another body.Make a copy of this answer, with another body.withHeader(String name, String value) Make a copy of this answer, with an extra header.withStatus(int status) Make a copy of this answer, with another status code.
-
Constructor Details
-
Simple
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 ctor.- Parameters:
status- HTTP statusbody- Body of HTTP response
-
Simple
Public ctor.- Parameters:
status- HTTP statusheaders- HTTP headersbody- Body of HTTP response
-
-
Method Details
-
status
public int status()Description copied from interface:MkAnswerHTTP response status. -
headers
Description copied from interface:MkAnswerHTTP response headers. -
body
Description copied from interface:MkAnswerHTTP response body. -
bodyBytes
public byte[] bodyBytes()Description copied from interface:MkAnswerHTTP response body as bytes. -
toString
-
withHeader
Make a copy of this answer, with an extra header.- Parameters:
name- Name of the headervalue- ImmutableHeader value- Returns:
- New answer
-
withStatus
Make a copy of this answer, with another status code.- Parameters:
status- Status code- Returns:
- New answer
-
withBody
Make a copy of this answer, with another body.- Parameters:
body- Body- Returns:
- New answer
-
withBody
Make a copy of this answer, with another body.- Parameters:
body- Body- Returns:
- New answer
-