public class DefaultGoApiResponse extends GoApiResponse
| Modifier and Type | Field and Description |
|---|---|
static int |
INTERNAL_ERROR |
static int |
REDIRECT_RESPONSE_CODE |
static int |
SUCCESS_RESPONSE_CODE |
static int |
VALIDATION_ERROR |
| Constructor and Description |
|---|
DefaultGoApiResponse(int responseCode)
Constructs DefaultGoApiResponse with response code
|
| Modifier and Type | Method and Description |
|---|---|
void |
addResponseHeader(String name,
String value)
Adds new response header.
|
static DefaultGoApiResponse |
badRequest(String responseBody)
Creates an instance DefaultGoApiResponse which represents bad request with response code 400
|
static DefaultGoApiResponse |
error(String responseBody)
Creates an instance DefaultGoApiResponse which represents error request with response code 500
|
static DefaultGoApiResponse |
incompleteRequest(String responseBody)
Creates an instance DefaultGoApiResponse which represents incomplete request with response code 412
|
String |
responseBody()
Provides json formatted response body
|
int |
responseCode()
Provides response code for the request sent
|
Map<String,String> |
responseHeaders()
Provides response headers as key value pair for the response.
|
void |
setResponseBody(String responseBody)
Sets response body
|
static DefaultGoApiResponse |
success(String responseBody)
Creates an instance DefaultGoApiResponse which represents success request with response code 200
|
public static final int SUCCESS_RESPONSE_CODE
public static final int REDIRECT_RESPONSE_CODE
public static final int INTERNAL_ERROR
public static final int VALIDATION_ERROR
public DefaultGoApiResponse(int responseCode)
responseCode - Response code for the responsepublic static DefaultGoApiResponse incompleteRequest(String responseBody)
responseBody - Response bodypublic static DefaultGoApiResponse badRequest(String responseBody)
responseBody - Response bodypublic static DefaultGoApiResponse error(String responseBody)
responseBody - Response bodypublic static DefaultGoApiResponse success(String responseBody)
responseBody - Json formatted response bodypublic void addResponseHeader(String name, String value)
name - Name of the headervalue - Value of the headerpublic void setResponseBody(String responseBody)
responseBody - Json formatted response body represented as stringpublic int responseCode()
responseCode in class GoApiResponsepublic Map<String,String> responseHeaders()
responseHeaders in class GoApiResponsepublic String responseBody()
responseBody in class GoApiResponseCopyright © 2014 ThoughtWorks, Inc. Go Version: 16.2.1-175