Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RequestInit#duplex #719

Merged
merged 4 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api-reports/2_12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 3 additions & 0 deletions api-reports/2_13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
13 changes: 13 additions & 0 deletions dom/src/main/scala-2/org/scalajs/dom/RequestDuplex.scala
Original file line number Diff line number Diff line change
@@ -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]
}
12 changes: 12 additions & 0 deletions dom/src/main/scala-3/org/scalajs/dom/RequestDuplex.scala
Original file line number Diff line number Diff line change
@@ -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"
}
5 changes: 5 additions & 0 deletions dom/src/main/scala/org/scalajs/dom/RequestInit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down