supertokens / supertokens-website

Frontend SDK for SuperTokens - for session management + automatically refreshing sessions
https://supertokens.com
Other
54 stars 13 forks source link

fix: JSON parse error for non-JSON body in XMLHttpRequest #259

Closed anku255 closed 5 months ago

anku255 commented 5 months ago

Summary of change

In xmlhttprequest, a JSON.parse was being called on a non-JSON body when the status code was 403. This PR removes JSON.parse from the xmlhttprequest handler function. The onInvalidClaimResponse function gracefully handles all response body types, eliminating the need for JSON parsing in xmlhttprequest.

This issue existed for some time but was previously ignored. Recent changes in #258 exposed the error.

Related issues

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)

Documentation changes

(If relevant, please create a PR in our docs repo, or create a checklist here highlighting the necessary changes)

Checklist for important updates

github-actions[bot] commented 5 months ago

size-limit report 📦

Path Size
lib/build/bundleEntry.js 21.01 KB (-0.01% 🔽)