T
- Response type.public interface Request<T>
Connection
.
Models an HTTP request relative to a base URL (e.g. https://api.heroku.com).Modifier and Type | Method and Description |
---|---|
String |
getBody()
Value of the request body.
|
Map<String,?> |
getBodyAsMap()
Value of the request body as a Map.
|
String |
getEndpoint()
Path and query parameters of a URL.
|
Map<String,String> |
getHeaders()
Map of request-specific HTTP headers. |
Http.Method |
getHttpMethod()
HTTP method.
|
T |
getResponse(byte[] bytes,
int status,
Map<String,String> headers)
Response handler.
|
Http.Accept |
getResponseType()
HTTP Accept header.
|
boolean |
hasBody()
Whether or not the request has a body.
|
Http.Method getHttpMethod()
String getEndpoint()
boolean hasBody()
String getBody()
UnsupportedOperationException
- Generally thrown if hasBody()
returns falseMap<String,?> getBodyAsMap()
UnsupportedOperationException
- Generally thrown if hasBody()
returns falseHttp.Accept getResponseType()
Http.Accept
Map<String,String> getHeaders()
Map
of request-specific HTTP headers.T getResponse(byte[] bytes, int status, Map<String,String> headers)
bytes
- Data returned from the request.status
- HTTP status code.T
as specified by an individual request.RequestFailedException
- Generally thrown when the HTTP status code is 4XX.Copyright © 2017. All rights reserved.