Package com.microsoft.playwright.impl
Class RequestOptionsImpl
- java.lang.Object
-
- com.microsoft.playwright.impl.RequestOptionsImpl
-
- All Implemented Interfaces:
RequestOptions
public class RequestOptionsImpl extends java.lang.Object implements RequestOptions
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.Objectdata(package private) java.lang.BooleanfailOnStatusCode(package private) FormDataImplform(package private) java.util.Map<java.lang.String,java.lang.String>headers(package private) java.lang.BooleanignoreHTTPSErrors(package private) java.lang.IntegermaxRedirects(package private) java.lang.Stringmethod(package private) FormDataImplmultipart(package private) java.util.Map<java.lang.String,java.lang.Object>params(package private) java.lang.Doubletimeout
-
Constructor Summary
Constructors Constructor Description RequestOptionsImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RequestOptionssetData(byte[] data)Sets the request's post data.RequestOptionssetData(java.lang.Object data)Sets the request's post data.RequestOptionssetData(java.lang.String data)Sets the request's post data.RequestOptionssetFailOnStatusCode(boolean failOnStatusCode)RequestOptionssetForm(FormData form)ProvidesFormDataobject that will be serialized as html form usingapplication/x-www-form-urlencodedencoding and sent as this request body.RequestOptionssetHeader(java.lang.String name, java.lang.String value)Sets an HTTP header to the request.RequestOptionssetIgnoreHTTPSErrors(boolean ignoreHTTPSErrors)RequestOptionssetMaxRedirects(int maxRedirects)RequestOptionssetMethod(java.lang.String method)Changes the request method (e.g.RequestOptionssetMultipart(FormData form)ProvidesFormDataobject that will be serialized as html form usingmultipart/form-dataencoding and sent as this request body.RequestOptionssetQueryParam(java.lang.String name, boolean value)Adds a query parameter to the request URL.RequestOptionssetQueryParam(java.lang.String name, int value)Adds a query parameter to the request URL.RequestOptionssetQueryParam(java.lang.String name, java.lang.String value)Adds a query parameter to the request URL.private RequestOptionssetQueryParamImpl(java.lang.String name, java.lang.Object value)RequestOptionssetTimeout(double timeout)Sets request timeout in milliseconds.
-
-
-
Field Detail
-
params
java.util.Map<java.lang.String,java.lang.Object> params
-
method
java.lang.String method
-
headers
java.util.Map<java.lang.String,java.lang.String> headers
-
data
java.lang.Object data
-
form
FormDataImpl form
-
multipart
FormDataImpl multipart
-
failOnStatusCode
java.lang.Boolean failOnStatusCode
-
ignoreHTTPSErrors
java.lang.Boolean ignoreHTTPSErrors
-
timeout
java.lang.Double timeout
-
maxRedirects
java.lang.Integer maxRedirects
-
-
Method Detail
-
setHeader
public RequestOptions setHeader(java.lang.String name, java.lang.String value)
Description copied from interface:RequestOptionsSets an HTTP header to the request. This header will apply to the fetched request as well as any redirects initiated by it.- Specified by:
setHeaderin interfaceRequestOptions- Parameters:
name- Header name.value- Header value.
-
setData
public RequestOptions setData(java.lang.String data)
Description copied from interface:RequestOptionsSets the request's post data.- Specified by:
setDatain interfaceRequestOptions- Parameters:
data- Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string andcontent-typeheader will be set toapplication/jsonif not explicitly set. Otherwise thecontent-typeheader will be set toapplication/octet-streamif not explicitly set.
-
setData
public RequestOptions setData(byte[] data)
Description copied from interface:RequestOptionsSets the request's post data.- Specified by:
setDatain interfaceRequestOptions- Parameters:
data- Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string andcontent-typeheader will be set toapplication/jsonif not explicitly set. Otherwise thecontent-typeheader will be set toapplication/octet-streamif not explicitly set.
-
setData
public RequestOptions setData(java.lang.Object data)
Description copied from interface:RequestOptionsSets the request's post data.- Specified by:
setDatain interfaceRequestOptions- Parameters:
data- Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string andcontent-typeheader will be set toapplication/jsonif not explicitly set. Otherwise thecontent-typeheader will be set toapplication/octet-streamif not explicitly set.
-
setForm
public RequestOptions setForm(FormData form)
Description copied from interface:RequestOptionsProvidesFormDataobject that will be serialized as html form usingapplication/x-www-form-urlencodedencoding and sent as this request body. If this parameter is specifiedcontent-typeheader will be set toapplication/x-www-form-urlencodedunless explicitly provided.- Specified by:
setFormin interfaceRequestOptions- Parameters:
form- Form data to be serialized as html form usingapplication/x-www-form-urlencodedencoding and sent as this request body.
-
setMethod
public RequestOptions setMethod(java.lang.String method)
Description copied from interface:RequestOptions- Specified by:
setMethodin interfaceRequestOptions- Parameters:
method- Request method, e.g. POST.
-
setMultipart
public RequestOptions setMultipart(FormData form)
Description copied from interface:RequestOptionsProvidesFormDataobject that will be serialized as html form usingmultipart/form-dataencoding and sent as this request body. If this parameter is specifiedcontent-typeheader will be set tomultipart/form-dataunless explicitly provided.- Specified by:
setMultipartin interfaceRequestOptions- Parameters:
form- Form data to be serialized as html form usingmultipart/form-dataencoding and sent as this request body.
-
setQueryParam
public RequestOptions setQueryParam(java.lang.String name, java.lang.String value)
Description copied from interface:RequestOptionsAdds a query parameter to the request URL.- Specified by:
setQueryParamin interfaceRequestOptions- Parameters:
name- Parameter name.value- Parameter value.
-
setQueryParam
public RequestOptions setQueryParam(java.lang.String name, boolean value)
Description copied from interface:RequestOptionsAdds a query parameter to the request URL.- Specified by:
setQueryParamin interfaceRequestOptions- Parameters:
name- Parameter name.value- Parameter value.
-
setQueryParam
public RequestOptions setQueryParam(java.lang.String name, int value)
Description copied from interface:RequestOptionsAdds a query parameter to the request URL.- Specified by:
setQueryParamin interfaceRequestOptions- Parameters:
name- Parameter name.value- Parameter value.
-
setQueryParamImpl
private RequestOptions setQueryParamImpl(java.lang.String name, java.lang.Object value)
-
setTimeout
public RequestOptions setTimeout(double timeout)
Description copied from interface:RequestOptionsSets request timeout in milliseconds. Defaults to30000(30 seconds). Pass0to disable timeout.- Specified by:
setTimeoutin interfaceRequestOptions- Parameters:
timeout- Request timeout in milliseconds.
-
setFailOnStatusCode
public RequestOptions setFailOnStatusCode(boolean failOnStatusCode)
- Specified by:
setFailOnStatusCodein interfaceRequestOptions- Parameters:
failOnStatusCode- Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.
-
setIgnoreHTTPSErrors
public RequestOptions setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors)
- Specified by:
setIgnoreHTTPSErrorsin interfaceRequestOptions- Parameters:
ignoreHTTPSErrors- Whether to ignore HTTPS errors when sending network requests.
-
setMaxRedirects
public RequestOptions setMaxRedirects(int maxRedirects)
- Specified by:
setMaxRedirectsin interfaceRequestOptions- Parameters:
maxRedirects- Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is exceeded. Defaults to20. Pass0to not follow redirects.
-
-