Class Route.FetchOptions

  • Enclosing interface:
    Route

    public static class Route.FetchOptions
    extends Object
    • Field Detail

      • headers

        public Map<String,​String> headers
        If set changes the request HTTP headers. Header values will be converted to a string.
      • maxRedirects

        public Integer 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.
      • maxRetries

        public Integer maxRetries
        Maximum number of times network errors should be retried. Currently only ECONNRESET error is retried. Does not retry based on HTTP response codes. An error will be thrown if the limit is exceeded. Defaults to 0 - no retries.
      • method

        public String method
        If set changes the request method (e.g. GET or POST).
      • postData

        public Object postData
        If set changes the post data of request.
      • timeout

        public Double timeout
        Request timeout in milliseconds. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
      • url

        public String url
        If set changes the request URL. New URL must have same protocol as original one.
    • Constructor Detail

      • FetchOptions

        public FetchOptions()
    • Method Detail

      • setHeaders

        public Route.FetchOptions setHeaders​(Map<String,​String> headers)
        If set changes the request HTTP headers. Header values will be converted to a string.
      • setMaxRedirects

        public Route.FetchOptions setMaxRedirects​(int 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.
      • setMaxRetries

        public Route.FetchOptions setMaxRetries​(int maxRetries)
        Maximum number of times network errors should be retried. Currently only ECONNRESET error is retried. Does not retry based on HTTP response codes. An error will be thrown if the limit is exceeded. Defaults to 0 - no retries.
      • setMethod

        public Route.FetchOptions setMethod​(String method)
        If set changes the request method (e.g. GET or POST).
      • setPostData

        public Route.FetchOptions setPostData​(byte[] postData)
        If set changes the post data of request.
      • setTimeout

        public Route.FetchOptions setTimeout​(double timeout)
        Request timeout in milliseconds. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
      • setUrl

        public Route.FetchOptions setUrl​(String url)
        If set changes the request URL. New URL must have same protocol as original one.