Module org.htmlunit
Package org.htmlunit

Enum Class WebRequest.FetchMode

java.lang.Object
java.lang.Enum<WebRequest.FetchMode>
org.htmlunit.WebRequest.FetchMode
All Implemented Interfaces:
Serializable, Comparable<WebRequest.FetchMode>, Constable
Enclosing class:
WebRequest

public static enum WebRequest.FetchMode extends Enum<WebRequest.FetchMode>
The mode of a request, as defined by the Fetch spec ( https://fetch.spec.whatwg.org/#concept-request-mode).

This is used to compute the value of the Sec-Fetch-Mode request header. Most WebRequest.FetchDestinations imply a fixed mode; this only needs to be set explicitly to override that default - e.g. for a fetch() call using an explicit mode option, or a subresource request using the crossorigin attribute.

  • Enum Constant Details

    • SAME_ORIGIN

      public static final WebRequest.FetchMode SAME_ORIGIN
      Same-origin requests, e.g. worker scripts, or fetch() with mode: 'same-origin'.
    • NO_CORS

      public static final WebRequest.FetchMode NO_CORS
      Subresource requests without CORS, e.g. <img> without crossorigin.
    • CORS

      public static final WebRequest.FetchMode CORS
      CORS-enabled requests, e.g. XMLHttpRequest, fetch() default, or module scripts.
    • WEBSOCKET

      public static final WebRequest.FetchMode WEBSOCKET
      WebSocket handshake requests.
  • Method Details

    • values

      public static WebRequest.FetchMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static WebRequest.FetchMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public String getValue()
      Returns the value to be used for the Sec-Fetch-Mode header.
      Returns:
      the value to be used for the Sec-Fetch-Mode header