You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using m.request with responseType to request non-text data (like blobs and arraybuffers) it fails with a DOMException as it tries to read .responseText and it's only valid for text content.
Expected Behavior
Requesting data using responseType set to any valid value should not throw an error and the response could be accessed someway (on v2.0.0-rc.1 it could be accessed using extract).
Current Behavior
The request fails when responseType is set to valid values which aren't "text" or a empty string, like "arraybuffer" or "blob".
Possible Solutions
Don't read xhr.responseText when extract is defined (restore v2.0.0-rc.1 behavior);
Don't read xhr.responseText when responseType is not falsy or "text", instead read xhr.response. It allows using deserialize to handle non-text responses keeping the default xhr.status error handling (which is disabled when using extract).
Mithril Version: v2.0.0-rc.3
When using
m.request
with responseType to request non-text data (like blobs and arraybuffers) it fails with a DOMException as it tries to read.responseText
and it's only valid for text content.Expected Behavior
Requesting data using
responseType
set to any valid value should not throw an error and the response could be accessed someway (on v2.0.0-rc.1 it could be accessed usingextract
).Current Behavior
The request fails when
responseType
is set to valid values which aren't "text" or a empty string, like "arraybuffer" or "blob".Possible Solutions
xhr.responseText
whenextract
is defined (restore v2.0.0-rc.1 behavior);xhr.responseText
whenresponseType
is not falsy or "text", instead readxhr.response
. It allows usingdeserialize
to handle non-text responses keeping the defaultxhr.status
error handling (which is disabled when usingextract
).Steps to Reproduce
JSFiddle for v2.0.0-rc.1 and v2.0.0-rc.3
Context
I'm trying to request binary data using
m.request
.Additional Information
Your Environment
The text was updated successfully, but these errors were encountered: