Class APIRequest.NewContextOptions

  • Enclosing interface:
    APIRequest

    public static class APIRequest.NewContextOptions
    extends java.lang.Object
    • Field Detail

      • baseURL

        public java.lang.String baseURL
        Methods like APIRequestContext.get() take the base URL into consideration by using the URL() constructor for building the corresponding URL. Examples:
        • baseURL: http://localhost:3000 and sending request to /bar.html results in http://localhost:3000/bar.html
        • baseURL: http://localhost:3000/foo/ and sending request to ./bar.html results in http://localhost:3000/foo/bar.html
        • baseURL: http://localhost:3000/foo (without trailing slash) and navigating to ./bar.html results in http://localhost:3000/bar.html
      • extraHTTPHeaders

        public java.util.Map<java.lang.String,​java.lang.String> extraHTTPHeaders
        An object containing additional HTTP headers to be sent with every request. Defaults to none.
      • httpCredentials

        public HttpCredentials httpCredentials
        Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
      • ignoreHTTPSErrors

        public java.lang.Boolean ignoreHTTPSErrors
        Whether to ignore HTTPS errors when sending network requests. Defaults to false.
      • proxy

        public Proxy proxy
        Network proxy settings.
      • storageStatePath

        public java.nio.file.Path storageStatePath
        Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via BrowserContext.storageState(). Path to the file with saved storage state.
      • timeout

        public java.lang.Double timeout
        Maximum time in milliseconds to wait for the response. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
      • userAgent

        public java.lang.String userAgent
        Specific user agent to use in this context.
    • Constructor Detail

      • NewContextOptions

        public NewContextOptions()
    • Method Detail

      • setBaseURL

        public APIRequest.NewContextOptions setBaseURL​(java.lang.String baseURL)
        Methods like APIRequestContext.get() take the base URL into consideration by using the URL() constructor for building the corresponding URL. Examples:
        • baseURL: http://localhost:3000 and sending request to /bar.html results in http://localhost:3000/bar.html
        • baseURL: http://localhost:3000/foo/ and sending request to ./bar.html results in http://localhost:3000/foo/bar.html
        • baseURL: http://localhost:3000/foo (without trailing slash) and navigating to ./bar.html results in http://localhost:3000/bar.html
      • setExtraHTTPHeaders

        public APIRequest.NewContextOptions setExtraHTTPHeaders​(java.util.Map<java.lang.String,​java.lang.String> extraHTTPHeaders)
        An object containing additional HTTP headers to be sent with every request. Defaults to none.
      • setHttpCredentials

        public APIRequest.NewContextOptions setHttpCredentials​(java.lang.String username,
                                                               java.lang.String password)
        Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
      • setIgnoreHTTPSErrors

        public APIRequest.NewContextOptions setIgnoreHTTPSErrors​(boolean ignoreHTTPSErrors)
        Whether to ignore HTTPS errors when sending network requests. Defaults to false.
      • setStorageStatePath

        public APIRequest.NewContextOptions setStorageStatePath​(java.nio.file.Path storageStatePath)
        Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via BrowserContext.storageState(). Path to the file with saved storage state.
      • setTimeout

        public APIRequest.NewContextOptions setTimeout​(double timeout)
        Maximum time in milliseconds to wait for the response. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
      • setUserAgent

        public APIRequest.NewContextOptions setUserAgent​(java.lang.String userAgent)
        Specific user agent to use in this context.