Class RequestOptionsImpl

java.lang.Object
com.microsoft.playwright.impl.RequestOptionsImpl
All Implemented Interfaces:
RequestOptions

public class RequestOptionsImpl extends Object implements RequestOptions
  • Field Details

  • Constructor Details

    • RequestOptionsImpl

      public RequestOptionsImpl()
  • Method Details

    • setHeader

      public RequestOptions setHeader(String name, String value)
      Description copied from interface: RequestOptions
      Sets an HTTP header to the request. This header will apply to the fetched request as well as any redirects initiated by it.
      Specified by:
      setHeader in interface RequestOptions
      Parameters:
      name - Header name.
      value - Header value.
    • setData

      public RequestOptions setData(String data)
      Description copied from interface: RequestOptions
      Sets the request's post data.
      Specified by:
      setData in interface RequestOptions
      Parameters:
      data - Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and content-type header will be set to application/json if not explicitly set. Otherwise the content-type header will be set to application/octet-stream if not explicitly set.
    • setData

      public RequestOptions setData(byte[] data)
      Description copied from interface: RequestOptions
      Sets the request's post data.
      Specified by:
      setData in interface RequestOptions
      Parameters:
      data - Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and content-type header will be set to application/json if not explicitly set. Otherwise the content-type header will be set to application/octet-stream if not explicitly set.
    • setData

      public RequestOptions setData(Object data)
      Description copied from interface: RequestOptions
      Sets the request's post data.
      Specified by:
      setData in interface RequestOptions
      Parameters:
      data - Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and content-type header will be set to application/json if not explicitly set. Otherwise the content-type header will be set to application/octet-stream if not explicitly set.
    • setForm

      public RequestOptions setForm(FormData form)
      Description copied from interface: RequestOptions
      Provides FormData object that will be serialized as html form using application/x-www-form-urlencoded encoding and sent as this request body. If this parameter is specified content-type header will be set to application/x-www-form-urlencoded unless explicitly provided.
      Specified by:
      setForm in interface RequestOptions
      Parameters:
      form - Form data to be serialized as html form using application/x-www-form-urlencoded encoding and sent as this request body.
    • setMethod

      public RequestOptions setMethod(String method)
      Description copied from interface: RequestOptions
      Changes the request method (e.g. PUT or POST).
      Specified by:
      setMethod in interface RequestOptions
      Parameters:
      method - Request method, e.g. POST.
    • setMultipart

      public RequestOptions setMultipart(FormData form)
      Description copied from interface: RequestOptions
      Provides FormData object that will be serialized as html form using multipart/form-data encoding and sent as this request body. If this parameter is specified content-type header will be set to multipart/form-data unless explicitly provided.
      Specified by:
      setMultipart in interface RequestOptions
      Parameters:
      form - Form data to be serialized as html form using multipart/form-data encoding and sent as this request body.
    • setQueryParam

      public RequestOptions setQueryParam(String name, String value)
      Description copied from interface: RequestOptions
      Adds a query parameter to the request URL.
      Specified by:
      setQueryParam in interface RequestOptions
      Parameters:
      name - Parameter name.
      value - Parameter value.
    • setQueryParam

      public RequestOptions setQueryParam(String name, boolean value)
      Description copied from interface: RequestOptions
      Adds a query parameter to the request URL.
      Specified by:
      setQueryParam in interface RequestOptions
      Parameters:
      name - Parameter name.
      value - Parameter value.
    • setQueryParam

      public RequestOptions setQueryParam(String name, int value)
      Description copied from interface: RequestOptions
      Adds a query parameter to the request URL.
      Specified by:
      setQueryParam in interface RequestOptions
      Parameters:
      name - Parameter name.
      value - Parameter value.
    • setQueryParamImpl

      private RequestOptions setQueryParamImpl(String name, Object value)
    • setTimeout

      public RequestOptions setTimeout(double timeout)
      Description copied from interface: RequestOptions
      Sets request timeout in milliseconds. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
      Specified by:
      setTimeout in interface RequestOptions
      Parameters:
      timeout - Request timeout in milliseconds.
    • setFailOnStatusCode

      public RequestOptions setFailOnStatusCode(boolean failOnStatusCode)
      Specified by:
      setFailOnStatusCode in interface RequestOptions
      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:
      setIgnoreHTTPSErrors in interface RequestOptions
      Parameters:
      ignoreHTTPSErrors - Whether to ignore HTTPS errors when sending network requests.
    • setMaxRedirects

      public RequestOptions setMaxRedirects(int maxRedirects)
      Specified by:
      setMaxRedirects in interface RequestOptions
      Parameters:
      maxRedirects - Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is exceeded. Defaults to 20. Pass 0 to not follow redirects.