Skip to content

nGrinder HTTP Client Specifications

Imbyungjun edited this page Apr 28, 2021 · 1 revision

This page has written based on version 3.5.5

org.ngrinder.http.HTTPRequest

All the methods specified below are return org.ngrinder.http.HTTPResponse.

HEAD Method

Method and Parameters Description
HEAD(String uri) request HEAD method to given URI
HEAD(String uri, String Map<String, String> params) request HEAD method to given URI and parameters. The parameters will be converted to List<NameValuePair>
HEAD(String uri, String Map<String, String> params, Map<String, String> headers) request HEAD method to given URI, parameters and headers. The parameters and headers will be converted to List<NameValuePair> and List<Header>
HEAD(String uri, String NVPair[] params) request HEAD method to given URI and parameters. The parameters will be converted to List<NameValuePair>
HEAD(String uri, String NVPair[] params, NVPair[] headers) request HEAD method to given URI, parameters and headers. The parameters and headers will be converted to List<NameValuePair> and List<Header>
HEAD(String uri, List<NameValuePair> params, List<Header> headers) request HEAD method to given URI with specified parameters and headers.

GET Method

Method and Parameters Description
GET(String uri) request GET method to given URI
GET(String uri, Map<String, String> params) request GET method to given URI and parameters. The parameters will be converted to List<NameValuePair>
GET(String uri, Map<String, String> params, Map<String, String> headers) request GET method to given URI, parameters and headers. The parameters and headers will be converted to List<NameValuePair> and List<Header>
GET(String uri, NVPair[] params) request GET method to given URI and parameters. The parameters will be converted to List<NameValuePair>
GET(String uri, NVPair[] params, NVPair[] headers) request GET method to given URI, parameters and headers. The parameters and headers will be converted to List<NameValuePair> and List<Header>
GET(String uri, List<NameValuePair> params, List<Header> headers) request GET method to given URI with specified parameters and headers.

POST Method

Method and Parameters Description
POST(String uri) request POST method to given URI with empty body
POST(String uri, Map<?, ?> params) request POST method to given URI with body. The parameter will be converted to JSON by default
POST(String uri, Map<?, ?> params, Map<String, String> headers) request POST method to given URI with body. The parameter will be converted to JSON or form-data based on Content-Type header. The headers will be converted to List<Header>
POST(String uri, Map<?, ?> params, List<Header> headers) request POST method to given URI with body. The parameter will be converted to JSON or form-data based on Content-Type header.
POST(String uri, NVPair[] params) request POST method to given URI with body. The parameter will be converted to JSON by default
POST(String uri, NVPair[] params, NVPair[] headers) request POST method to given URI with body. The parameter will be converted to JSON or form-data based on Content-Type header. The headers will be converted to List<Header>
POST(String uri, byte[] content) request POST method to given URI with body. The parameter will be tranfered as byte array
POST(String uri, byte[] content, Map<String, String> headers) request POST method to given URI with body. The parameter will be tranfered as byte array. The headers will be converted to List<Header>
POST(String uri, byte[] content, List<Header> headers) request POST method to given URI with body. The parameter will be tranfered as byte array
POST(String uri, AsyncEntityProducer asyncEntityProducer) request POST method to given URI with AsyncEntityProducer
POST(String uri, AsyncEntityProducer asyncEntityProducer, Map<String, String> headers) request POST method to given URI with AsyncEntityProducer
POST(String uri, AsyncEntityProducer asyncEntityProducer, List<Header> headers) request POST method to given URI with AsyncEntityProducer
POST(String uri, List<NameValuePair> params, List<Header> headers) request POST method to given URI with form-data parameter

PUT Method

Method and Parameters Description
PUT(String uri) request PUT method to given URI with empty body
PUT(String uri, Map<?, ?> params) request PUT method to given URI with body. The parameter will be converted to JSON by default
PUT(String uri, Map<?, ?> params, Map<String, String> headers) request PUT method to given URI with body. The parameter will be converted to JSON or form-data based on Content-Type header. The headers will be converted to List<Header>
PUT(String uri, Map<?, ?> params, List<Header> headers) request PUT method to given URI with body. The parameter will be converted to JSON or form-data based on Content-Type header.
PUT(String uri, NVPair[] params) request PUT method to given URI with body. The parameter will be converted to JSON by default
PUT(String uri, NVPair[] params, NVPair[] headers) request PUT method to given URI with body. The parameter will be converted to JSON or form-data based on Content-Type header. The headers will be converted to List<Header>
PUT(String uri, byte[] content) request PUT method to given URI with body. The parameter will be tranfered as byte array
PUT(String uri, byte[] content, Map<String, String> headers) request PUT method to given URI with body. The parameter will be tranfered as byte array. The headers will be converted to List<Header>
PUT(String uri, byte[] content, List<Header> headers) request PUT method to given URI with body. The parameter will be tranfered as byte array
PUT(String uri, AsyncEntityProducer asyncEntityProducer) request PUT method to given URI with AsyncEntityProducer
PUT(String uri, AsyncEntityProducer asyncEntityProducer, Map<String, String> headers) request PUT method to given URI with AsyncEntityProducer
PUT(String uri, AsyncEntityProducer asyncEntityProducer, List<Header> headers) request PUT method to given URI with AsyncEntityProducer
PUT(String uri, List<NameValuePair> params, List<Header> headers) request PUT method to given URI with form-data parameter

PATCH Method

Method and Parameters Description
PATCH(String uri) request PATCH method to given URI with empty body
PATCH(String uri, Map<?, ?> params) request PATCH method to given URI with body. The parameter will be converted to JSON by default
PATCH(String uri, Map<?, ?> params, Map<String, String> headers) request PATCH method to given URI with body. The parameter will be converted to JSON or form-data based on Content-Type header. The headers will be converted to List<Header>
PATCH(String uri, Map<?, ?> params, List<Header> headers) request PATCH method to given URI with body. The parameter will be converted to JSON or form-data based on Content-Type header.
PATCH(String uri, NVPair[] params) request PATCH method to given URI with body. The parameter will be converted to JSON by default
PATCH(String uri, NVPair[] params, NVPair[] headers) request PATCH method to given URI with body. The parameter will be converted to JSON or form-data based on Content-Type header. The headers will be converted to List<Header>
PATCH(String uri, byte[] content) request PATCH method to given URI with body. The parameter will be tranfered as byte array
PATCH(String uri, byte[] content, Map<String, String> headers) request PATCH method to given URI with body. The parameter will be tranfered as byte array. The headers will be converted to List<Header>
PATCH(String uri, byte[] content, List<Header> headers) request PATCH method to given URI with body. The parameter will be tranfered as byte array
PATCH(String uri, AsyncEntityProducer asyncEntityProducer) request PATCH method to given URI with AsyncEntityProducer
PATCH(String uri, AsyncEntityProducer asyncEntityProducer, Map<String, String> headers) request PATCH method to given URI with AsyncEntityProducer
PATCH(String uri, AsyncEntityProducer asyncEntityProducer, List<Header> headers) request PATCH method to given URI with AsyncEntityProducer
PATCH(String uri, List<NameValuePair> params, List<Header> headers) request PATCH method to given URI with form-data parameter

DELETE Method

Method and Parameters Description
DELETE(String uri) request DELETE method to given URI
DELETE(String uri, Map<String, String> params) request DELETE method to given URI and parameters. The parameters will be converted to List<NameValuePair>
DELETE(String uri, Map<String, String> params, Map<String, String> headers) request DELETE method to given URI, parameters and headers. The parameters and headers will be converted to List<NameValuePair> and List<Header>
DELETE(String uri, NVPair[] params) request DELETE method to given URI and parameters. The parameters will be converted to List<NameValuePair>
DELETE(String uri, NVPair[] params, NVPair[] headers) request DELETE method to given URI, parameters and headers. The parameters and headers will be converted to List<NameValuePair> and List<Header>
DELETE(String uri, List params, List headers) request DELETE method to given URI with specified parameters and headers.

org.ngrinder.http.HTTPResponse

Return Type Method and Parameters Description
byte[] getBodyBytes() get response body as a byte array
String getBodyText() get response body as a string with default charset
String getBodyText(Charset charset) get response body as a string with specified charset
T getBody(Function<String, T> converter) get response body with user defined converter
int getStatusCode() get HTTP response status code
ProtocolVersion getVersion() get used protocol version of HTTP response
Header getHeader(String name) get HTTP response header with given name
List getHeaders() get all the HTTP response headers
List getHeaders(String name) get HTTP response headers with given name
Clone this wiki locally