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

fix(svelte): parse Content-Type properly when directives are also specified in getResponseBody #21

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jchen42703
Copy link

@jchen42703 jchen42703 commented May 14, 2024

Fixes #20 and bumps version to 0.0.6 to make upgrading easier

@lietu
Copy link
Contributor

lietu commented May 14, 2024

Thanks for the PR and suggestion.

I would rather split from ; and take the left part for comparison, it's optional, but anything to the right of it can be ignored for these purposes. Also checking if the individual strings are contained in it does not mean it "starts with" it, and even if it starts with it - there might be something else relevant after that, so it may in some rare cases have issues.

image

Could you update the PR so that is extracted before doing the JSON_CONTENT_TYPES.includes -check with the result?

@jchen42703
Copy link
Author

@lietu I decided to call the .split in the .includes call since if contentType &&.. enforces a non-null string, which makes some of the typing clearer. It's a little ugly, but I think it's relatively clear?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specifying directives like charset in the response Content-Type breaks JSON response parsing in v0.0.5
2 participants