- java.lang.Object
-
- io.helidon.webserver.testsupport.TestRequest
-
public class TestRequest extends Object
An API to compose a test request.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestResponsecall(io.helidon.common.http.Http.RequestMethod method)Calls using specified HTTP method with body.TestResponsecall(io.helidon.common.http.Http.RequestMethod method, MediaPublisher mediaPublisher)Calls using specified HTTP method with body.TestResponsedelete()Calls HTTP DELETE method with body.TestResponsedelete(MediaPublisher mediaPublisher)Calls HTTP DELETE method with body.TestResponseget()Calls HTTP GET method with body.TestResponseget(MediaPublisher mediaPublisher)Calls HTTP GET method with body.TestResponsehead()Calls HTTP HEAD method with body.TestResponsehead(MediaPublisher mediaPublisher)Calls HTTP HEAD method with body.TestRequestheader(String name, String value)Add a header.TestResponseoptions()Calls HTTP OPTIONS method with body.TestResponseoptions(MediaPublisher mediaPublisher)Calls HTTP OPTIONS method with body.TestResponsepost()Calls HTTP POST method with body.TestResponsepost(MediaPublisher mediaPublisher)Calls HTTP POST method with body.TestResponseput()Calls HTTP PUT method with body.TestResponseput(MediaPublisher mediaPublisher)Calls HTTP PUT method with body.TestRequestqueryParameter(String name, String value)Add a query parameter.TestResponsetrace()Calls HTTP TRACE method with body.TestResponsetrace(MediaPublisher mediaPublisher)Calls HTTP TRACE method with body.TestRequestversion(io.helidon.common.http.Http.Version version)Define an HTTP version.
-
-
-
Method Detail
-
queryParameter
public TestRequest queryParameter(String name, String value)
Add a query parameter.- Parameters:
name- a name.value- a value.- Returns:
- Updated instance.
- Throws:
NullPointerException- Ifnameorvalueparameter isnull.
-
header
public TestRequest header(String name, String value)
Add a header.- Parameters:
name- a name.value- a value.- Returns:
- Updated instance.
- Throws:
NullPointerException- Ifnameorvalueparameter isnull.
-
version
public TestRequest version(io.helidon.common.http.Http.Version version)
Define an HTTP version. Default isHTTP/1.1.- Parameters:
version- a version to set.- Returns:
- Updated instance.
- Throws:
NullPointerException- Ifnameorvalueparameter isnull.
-
get
public TestResponse get(MediaPublisher mediaPublisher) throws InterruptedException, TimeoutException
Calls HTTP GET method with body.- Parameters:
mediaPublisher- a request body publisher.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
get
public TestResponse get() throws InterruptedException, TimeoutException
Calls HTTP GET method with body.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
post
public TestResponse post(MediaPublisher mediaPublisher) throws InterruptedException, TimeoutException
Calls HTTP POST method with body.- Parameters:
mediaPublisher- a request body publisher.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
post
public TestResponse post() throws InterruptedException, TimeoutException
Calls HTTP POST method with body.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
put
public TestResponse put(MediaPublisher mediaPublisher) throws InterruptedException, TimeoutException
Calls HTTP PUT method with body.- Parameters:
mediaPublisher- a request body publisher.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
put
public TestResponse put() throws InterruptedException, TimeoutException
Calls HTTP PUT method with body.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
delete
public TestResponse delete(MediaPublisher mediaPublisher) throws InterruptedException, TimeoutException
Calls HTTP DELETE method with body.- Parameters:
mediaPublisher- a request body publisher.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
delete
public TestResponse delete() throws InterruptedException, TimeoutException
Calls HTTP DELETE method with body.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
options
public TestResponse options(MediaPublisher mediaPublisher) throws InterruptedException, TimeoutException
Calls HTTP OPTIONS method with body.- Parameters:
mediaPublisher- a request body publisher.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
options
public TestResponse options() throws InterruptedException, TimeoutException
Calls HTTP OPTIONS method with body.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
head
public TestResponse head(MediaPublisher mediaPublisher) throws InterruptedException, TimeoutException
Calls HTTP HEAD method with body.- Parameters:
mediaPublisher- a request body publisher.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
head
public TestResponse head() throws InterruptedException, TimeoutException
Calls HTTP HEAD method with body.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
trace
public TestResponse trace(MediaPublisher mediaPublisher) throws InterruptedException, TimeoutException
Calls HTTP TRACE method with body.- Parameters:
mediaPublisher- a request body publisher.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
trace
public TestResponse trace() throws InterruptedException, TimeoutException
Calls HTTP TRACE method with body.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
call
public TestResponse call(io.helidon.common.http.Http.RequestMethod method, MediaPublisher mediaPublisher) throws InterruptedException, TimeoutException
Calls using specified HTTP method with body.- Parameters:
method- an HTTP method.mediaPublisher- a request body publisher.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
call
public TestResponse call(io.helidon.common.http.Http.RequestMethod method) throws InterruptedException, TimeoutException
Calls using specified HTTP method with body.- Parameters:
method- an HTTP method.- Returns:
- a response to read.
- Throws:
InterruptedException- if thread is interrupted.TimeoutException- if request timeout is reached.
-
-