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

stringifying xhr error response #2804

Closed

Conversation

boazblake
Copy link
Contributor

When an XHR error response is returned with responseType set to 'json' the error reponse is not handled correctly.

Description

When the responseText is type JSON the response is still assigned to the new Error which is expecting a string.

Motivation and Context

This PR is an attempt to address #2802

How Has This Been Tested?

I ran yarn test request/tests/test-request.js
I saw a bunch of warnings and errors that were unrelated I believe.

Types of changes

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation change

Checklist:

  • [ x] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • [ x] I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • [x ] All new and existing tests passed.
  • I have updated docs/changelog.md

Bumps [terser](https://github.com/terser/terser) from 4.3.4 to 4.8.1.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
@dead-claudia
Copy link
Member

Not accepting this unless you can figure out a way to do it for xhr.responseType === "arraybuffer" and similar. I'm not special-casing "json" without confirmation that's the only one affected.

Copy link
Member

@dead-claudia dead-claudia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment

@dead-claudia dead-claudia added Area: Core For anything dealing with Mithril core itself Type: Bug For bugs and any other unexpected breakage labels Sep 2, 2024
@dead-claudia dead-claudia requested a review from a team as a code owner September 23, 2024 11:58
@dead-claudia dead-claudia deleted the branch MithrilJS:next September 25, 2024 05:23
@dead-claudia
Copy link
Member

Closed due to the next branch being deleted. Thanks to https://github.com/orgs/community/discussions/139697, I can't resurrect this PR, so it'd have to be re-created against main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Core For anything dealing with Mithril core itself Type: Bug For bugs and any other unexpected breakage
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

3 participants