Skip to content

Add XMLHttpRequest.overrideMimeType #442

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

Merged
merged 3 commits into from
Aug 20, 2021
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
1 change: 1 addition & 0 deletions api-reports/2_12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24558,6 +24558,7 @@ raw/XMLHttpRequest[JC] var onprogress: js.Function1[ProgressEvent, _]
raw/XMLHttpRequest[JC] var onreadystatechange: js.Function1[Event, _]
raw/XMLHttpRequest[JC] var ontimeout: js.Function1[ProgressEvent, _]
raw/XMLHttpRequest[JC] def open(method: String, url: String, async: Boolean?, user: String?, password: String?): Unit
raw/XMLHttpRequest[JC] def overrideMimeType(mimeType: String): Unit
raw/XMLHttpRequest[JC] def readyState: Int
raw/XMLHttpRequest[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
raw/XMLHttpRequest[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
Expand Down
1 change: 1 addition & 0 deletions api-reports/2_13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24558,6 +24558,7 @@ raw/XMLHttpRequest[JC] var onprogress: js.Function1[ProgressEvent, _]
raw/XMLHttpRequest[JC] var onreadystatechange: js.Function1[Event, _]
raw/XMLHttpRequest[JC] var ontimeout: js.Function1[ProgressEvent, _]
raw/XMLHttpRequest[JC] def open(method: String, url: String, async: Boolean?, user: String?, password: String?): Unit
raw/XMLHttpRequest[JC] def overrideMimeType(mimeType: String): Unit
raw/XMLHttpRequest[JC] def readyState: Int
raw/XMLHttpRequest[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
raw/XMLHttpRequest[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
Expand Down
13 changes: 12 additions & 1 deletion src/main/scala/org/scalajs/dom/raw/lib.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4106,7 +4106,7 @@ class XMLHttpRequest extends EventTarget {
* is parsed as if it were a text/xml stream. When the responseType is set to "document"
* and the request has been made asynchronously, the response is parsed as a text/html
* stream. Note: If the server doesn't apply the text/xml Content-Type header, you
* can use overrideMimeType()to force XMLHttpRequest to parse it as XML anyway.
* can use overrideMimeType() to force XMLHttpRequest to parse it as XML anyway.
*
* MDN
*/
Expand Down Expand Up @@ -4173,6 +4173,17 @@ class XMLHttpRequest extends EventTarget {
*/
def abort(): Unit = js.native

/**
* The XMLHttpRequest method overrideMimeType() specifies a MIME type other than the
* one provided by the server to be used instead when interpreting the data being
* transferred in a request. This may be used, for example, to force a stream to be
* treated and parsed as "text/xml", even if the server does not report it as such.
* This method must be called before calling send().
*
* MDN
*/
def overrideMimeType(mimeType: String): Unit = js.native

def getAllResponseHeaders(): String = js.native

/**
Expand Down