diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index 0c7e86bb3..0d7e7afd5 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -16542,9 +16542,12 @@ RequestDestination[SO] val sharedworker: RequestDestination RequestDestination[SO] val subresource: RequestDestination RequestDestination[SO] val unknown: RequestDestination RequestDestination[SO] val worker: RequestDestination +RequestDuplex[JT] +RequestDuplex[SO] val half: RequestDuplex RequestInit[JT] var body: js.UndefOr[BodyInit] RequestInit[JT] var cache: js.UndefOr[RequestCache] RequestInit[JT] var credentials: js.UndefOr[RequestCredentials] +RequestInit[JT] var duplex: js.UndefOr[RequestDuplex] RequestInit[JT] var headers: js.UndefOr[HeadersInit] RequestInit[JT] var integrity: js.UndefOr[String] RequestInit[JT] var keepalive: js.UndefOr[Boolean] diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index 0c7e86bb3..0d7e7afd5 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -16542,9 +16542,12 @@ RequestDestination[SO] val sharedworker: RequestDestination RequestDestination[SO] val subresource: RequestDestination RequestDestination[SO] val unknown: RequestDestination RequestDestination[SO] val worker: RequestDestination +RequestDuplex[JT] +RequestDuplex[SO] val half: RequestDuplex RequestInit[JT] var body: js.UndefOr[BodyInit] RequestInit[JT] var cache: js.UndefOr[RequestCache] RequestInit[JT] var credentials: js.UndefOr[RequestCredentials] +RequestInit[JT] var duplex: js.UndefOr[RequestDuplex] RequestInit[JT] var headers: js.UndefOr[HeadersInit] RequestInit[JT] var integrity: js.UndefOr[String] RequestInit[JT] var keepalive: js.UndefOr[Boolean] diff --git a/dom/src/main/scala-2/org/scalajs/dom/RequestDuplex.scala b/dom/src/main/scala-2/org/scalajs/dom/RequestDuplex.scala new file mode 100644 index 000000000..de0973d2c --- /dev/null +++ b/dom/src/main/scala-2/org/scalajs/dom/RequestDuplex.scala @@ -0,0 +1,13 @@ +package org.scalajs.dom + +import scala.scalajs.js + +/** + * Fetch APIs [[https://fetch.spec.whatwg.org/#dom-requestinit-duplex RequestDuplex enum]] + */ +@js.native +sealed trait RequestDuplex extends js.Any + +object RequestDuplex { + val half: RequestDuplex = "half".asInstanceOf[RequestDuplex] +} diff --git a/dom/src/main/scala-3/org/scalajs/dom/RequestDuplex.scala b/dom/src/main/scala-3/org/scalajs/dom/RequestDuplex.scala new file mode 100644 index 000000000..41f5092ba --- /dev/null +++ b/dom/src/main/scala-3/org/scalajs/dom/RequestDuplex.scala @@ -0,0 +1,12 @@ +package org.scalajs.dom + +import scala.scalajs.js + +/** + * Fetch APIs [[https://fetch.spec.whatwg.org/#dom-requestinit-duplex RequestDuplex enum]] + */ +opaque type RequestDuplex <: String = String + +object RequestDuplex { + val half: RequestDuplex = "half" +} diff --git a/dom/src/main/scala/org/scalajs/dom/RequestInit.scala b/dom/src/main/scala/org/scalajs/dom/RequestInit.scala index f43401815..de8ea9bab 100644 --- a/dom/src/main/scala/org/scalajs/dom/RequestInit.scala +++ b/dom/src/main/scala/org/scalajs/dom/RequestInit.scala @@ -30,6 +30,11 @@ trait RequestInit extends js.Object { var signal: js.UndefOr[AbortSignal] = js.undefined + /** "half" is the only valid value and it is for initiating a half-duplex fetch (i.e., the user agent sends the entire + * request before processing the response). + */ + var duplex: js.UndefOr[RequestDuplex] = js.undefined + /** The whatwg spec section on [[https://fetch.spec.whatwg.org/#requestinit RequestInit dictionary]] has a comment * that states that this value "can only be set to null". In the detailed steps section for * [[https://fetch.spec.whatwg.org/#dom-request the Request(input,init) constructor]] it says even more clearly: "If