Skip to content

Fix issue #630: Unable to override Content-Type header charset #750

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

Closed

Conversation

Vastav1812
Copy link

Fix: Prevent automatic charset=utf-8 addition to Content-Type headers

Issue

When sending requests with Content-Type headers like "application/json", the Dart HTTP library automatically appends "charset=utf-8" to the header value. Some APIs reject requests with this charset specification, but users currently have no way to prevent this behavior.

Fixes #630 by giving users control over Content-Type headers.

Changes

  • Added useRawContentType boolean field to HttpRequestModel
  • Modified HTTP service to respect this setting when setting Content-Type headers
  • Added UI checkbox in Headers section labeled "Prevent charset in Content-Type"
  • Added tooltip and info dialog explaining the purpose of this option
  • Added application-wide setting to control default behavior for all requests
  • Added Content-Type header preview in Response Headers section

Implementation Details

  • When useRawContentType is true, Content-Type headers are sent without charset
  • When false (default), the standard behavior is maintained for compatibility
  • New requests inherit the application-wide setting

Testing Instructions

  1. Create a POST request with JSON body
  2. Observe that by default, Content-Type includes charset=utf-8
  3. Enable "Prevent charset in Content-Type" in Headers section
  4. Send request and verify Content-Type header is sent without charset
  5. Try with application-wide setting enabled to verify it applies to new requests

Related Issues

@animator
Copy link
Member

Please do not modify the PR template. Also, go through the issue and understand it better as this PR is currently not solving it.

@animator animator closed this Mar 31, 2025
@Vastav1812
Copy link
Author

So Sorry for that will re-fix the coming issue.

@animator
Copy link
Member

In case you are participating in GSoC, it is better that your submit your proposal first as the application window has already opened.

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.

Unable to override Content-Type header
2 participants