Class HttpRequestBodies
java.lang.Object
com.github.mjeanroy.junit.servers.client.HttpRequestBodies
Request Body Factories.
-
Method Summary
Modifier and TypeMethodDescriptionstatic HttpRequestBody
Create request body from givenfile
.static HttpRequestBody
Create request body from givenfile
.static HttpRequestBody
Create request body from givenfile
.static HttpRequestBody
Create request body from givenfile
.static HttpRequestBodyFormBuilder
Create builder that can be used to create form urlencoded request body.static HttpRequestBody
formUrlEncodedBody
(HttpParameter parameter, HttpParameter... others) Create form urlencoded body from given parameters.static HttpRequestBody
formUrlEncodedBody
(Collection<HttpParameter> parameters) Create form urlencoded body from given parameters.static HttpRequestBody
formUrlEncodedBody
(Map<String, String> parameters) Create form urlencoded body from given parameters.static HttpRequestBody
Create request body from givenfile
, defined with"image/jpeg"
content type.static HttpRequestBody
Create request body from givenpath
, defined with"image/jpeg"
content type.static HttpRequestBody
Create request body from given raw string and"application/json"
content type.Create builder that can be used to create multipart request body.static HttpRequestBody
Create request body from givenfile
, defined with"application/pdf"
content type.static HttpRequestBody
Create request body from givenpath
, defined with"application/pdf"
content type.static HttpRequestBody
Create request body from givenfile
, defined with"image/png"
content type.static HttpRequestBody
Create request body from givenpath
, defined with"image/png"
content type.static HttpRequestBody
requestBody
(String body) Create request body from given raw string.static HttpRequestBody
Create request body from given raw string and"text/plain"
content type.static HttpRequestBody
Create request body from given raw string and"application/xml"
content type.
-
Method Details
-
requestBody
Create request body from given raw string.- Parameters:
body
- The body string.- Returns:
- The request body.
- Throws:
NullPointerException
- Ifbody
isnull
-
jsonBody
Create request body from given raw string and"application/json"
content type.- Parameters:
body
- The JSON body string.- Returns:
- The request body.
- Throws:
NullPointerException
- Ifbody
isnull
-
xmlBody
Create request body from given raw string and"application/xml"
content type.- Parameters:
body
- The XML body string.- Returns:
- The request body.
- Throws:
NullPointerException
- Ifbody
isnull
-
textBody
Create request body from given raw string and"text/plain"
content type.- Parameters:
body
- The body string.- Returns:
- The request body.
- Throws:
NullPointerException
- Ifbody
isnull
-
fileBody
Create request body from givenfile
.- Parameters:
file
- The body file.- Returns:
- The request body.
- Throws:
NullPointerException
- Iffile
isnull
-
jpeg
Create request body from givenfile
, defined with"image/jpeg"
content type.- Parameters:
file
- The body file.- Returns:
- The request body.
- Throws:
NullPointerException
- Iffile
isnull
-
jpeg
Create request body from givenpath
, defined with"image/jpeg"
content type.- Parameters:
path
- The body path.- Returns:
- The request body.
- Throws:
NullPointerException
- Iffile
isnull
-
png
Create request body from givenfile
, defined with"image/png"
content type.- Parameters:
file
- The body file.- Returns:
- The request body.
- Throws:
NullPointerException
- Iffile
isnull
-
png
Create request body from givenpath
, defined with"image/png"
content type.- Parameters:
path
- The body file.- Returns:
- The request body.
- Throws:
NullPointerException
- Iffile
isnull
-
pdf
Create request body from givenfile
, defined with"application/pdf"
content type.- Parameters:
file
- The body file.- Returns:
- The request body.
- Throws:
NullPointerException
- Iffile
isnull
-
pdf
Create request body from givenpath
, defined with"application/pdf"
content type.- Parameters:
path
- The body file.- Returns:
- The request body.
- Throws:
NullPointerException
- Iffile
isnull
-
fileBody
Create request body from givenfile
.- Parameters:
file
- The body file.contentType
- The content type.- Returns:
- The request body.
- Throws:
NullPointerException
- Iffile
orcontentType
arenull
IllegalArgumentException
- IfcontentType
is empty or blank.
-
fileBody
Create request body from givenfile
.- Parameters:
path
- The body file.- Returns:
- The request body.
- Throws:
NullPointerException
- Ifpath
isnull
-
fileBody
Create request body from givenfile
.- Parameters:
path
- The body file.contentType
- The content type.- Returns:
- The request body.
- Throws:
NullPointerException
- Ifpath
orcontentType
arenull
IllegalArgumentException
- IfcontentType
is empty or blank.
-
formUrlEncodedBody
Create form urlencoded body from given parameters.- Parameters:
parameters
- Body parameters.- Returns:
- The request body.
-
formUrlEncodedBody
Create form urlencoded body from given parameters.- Parameters:
parameters
- Body parameters.- Returns:
- The request body.
-
formUrlEncodedBody
Create form urlencoded body from given parameters.- Parameters:
parameter
- First parameter.others
- Other parameters.- Returns:
- The request body.
-
formBuilder
Create builder that can be used to create form urlencoded request body.- Returns:
- The builder.
-
multipartBuilder
Create builder that can be used to create multipart request body.- Returns:
- The builder.
-