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 default content-type #28

Open
yougyung opened this issue Jan 5, 2025 · 0 comments · May be fixed by #30
Open

fix default content-type #28

yougyung opened this issue Jan 5, 2025 · 0 comments · May be fixed by #30
Assignees
Labels
bug Something isn't working

Comments

@yougyung
Copy link
Member

yougyung commented Jan 5, 2025

Environment

fetch-ax 2.0.3 version

Reproduction

// api
await instance.post(`${API_PATH.user}/parsing-text`, body);

// error
415 Unsupported Media Type

Describe the bug

When fetch sets formdata to body without specifying the content-type, the browser automatically sets the content-type.

However, in the case of fetch-ax, an error occurs because the default value of content-type is set to application/json. I think we should remove the default value of content-type.

Additional context

Previously, the reason fetch-ax set the default value of content-type to application/json was because of the expectation that json format would be sent as the body most often.

To satisfy this intention, logic will be added to check the body when requesting and, if it is a json type, automatically set application/json to the content-type.

Logs

No response

@yougyung yougyung added the bug Something isn't working label Jan 5, 2025
@yougyung yougyung self-assigned this Jan 5, 2025
@yougyung yougyung linked a pull request Jan 12, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant