Class

org.scalajs.dom.experimental

Headers

Related Doc: package experimental

Permalink

class Headers extends Object with Iterable[Array[ByteString]]

¶6.1 Headers Class of whatwg spec

The Headers interface of the Fetch API allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

For security reasons, some headers can only be controller by the user agent. These headers include the forbidden header names and forbidden response header names.

A Headers object also has an associated guard, which takes a value of immutable, request, request-no-cors, response, or none. This affects whether the set(), delete(), and append() methods will mutate the header. For more information see Guard.

You can retrieve a Headers object via the Request.headers and Response.headers properties, and create a new Headers object using the Headers.Headers() constructor.

MDN

Annotations
@RawJSType() @native() @JSGlobal()
Linear Supertypes
Iterable[Array[ByteString]], Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Headers
  2. Iterable
  3. Object
  4. Any
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Headers(map: HeadersInit = js.Array[js.Array[String]]())

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def append(name: ByteString, value: ByteString): Unit

    Permalink

    The append() method of the Headers interface appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist.

    The append() method of the Headers interface appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist.

    The difference between Headers.set and append() is that if the specified header already exists and accepts multiple values, Headers.set will overwrite the existing value with the new one, whereas append() will append the new value onto the end of the set of values.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def delete(name: ByteString): Unit

    Permalink

    The delete() method of the Headers interface deletes a header from the current Headers object.

  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def get(name: ByteString): UndefOr[ByteString]

    Permalink

    The get() method of the Headers interface returns the first value of a given header from within a Headers object .

    The get() method of the Headers interface returns the first value of a given header from within a Headers object . If the requested header doesn't exist in the Headers object, the call returns null.

    name

    a ByteString, ie. only ASCII chars

  12. def getAll(name: ByteString): Sequence[ByteString]

    Permalink

    The getAll() method of the Headers interface returns an array of all the values of a header within a Headers object with a given name.

    The getAll() method of the Headers interface returns an array of all the values of a header within a Headers object with a given name. If the requested header doesn't exist in the Headers object, it returns an empty array.

    name

    a ByteString, ie. only ASCII chars

  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def has(name: ByteString): Boolean

    Permalink

    The has() method of the Headers interface returns a boolean stating whether a Headers object contains a certain header.

    The has() method of the Headers interface returns a boolean stating whether a Headers object contains a certain header.

    name

    a ByteString, ie. only ASCII chars

  15. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  16. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  19. def jsIterator(): Iterator[Array[ByteString]]

    Permalink
    Definition Classes
    Headers → Iterable
    Annotations
    @JSName( js.Symbol.iterator )
  20. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  24. def set(name: ByteString, value: ByteString): Unit

    Permalink

    The set() method of the Headers interface sets a new value for an existing header inside a Headers object, or adds the header if it does not already exist.

    The set() method of the Headers interface sets a new value for an existing header inside a Headers object, or adds the header if it does not already exist.

    The difference between set() and Headers.append is that if the specified header already exists and accepts multiple values, set() overwrites the existing value with the new one, whereas Headers.append appends the new value to the end of the set of values.

    Not all headers can be set. See the list of forbidden header names in https://fetch.spec.whatwg.org/#terminology-headers

  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  26. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  27. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  28. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  29. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Iterable[Array[ByteString]]

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped