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: Fix for using charset from response headers instead of default UTF-8 #20862

Open
wants to merge 4 commits into
base: release
Choose a base branch
from

Conversation

balachandarsv
Copy link

Description

The REST-API response content are by default parsed in UTF-8 irrespective of what the response content-type header charset is sent.

Fixes #

Checks for any charset mentioned in response headers, if mentioned, it used the charset otherwise defaults to UTF-8

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Manual

Checklist:

Dev activity

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • PR is being merged under a feature flag

@welcome
Copy link

welcome bot commented Feb 22, 2023

Welcome to the Appsmith community! Thank you for your first pull request and making this project better. 🤗 Please make sure that you raise a review request so your code change does not go unnoticed.

@vercel
Copy link

vercel bot commented Feb 22, 2023

@balachandarsv is attempting to deploy a commit to the Appsmith Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link

github-actions bot commented Mar 1, 2023

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Mar 1, 2023
@github-actions
Copy link

github-actions bot commented Mar 9, 2023

This PR has been closed because of inactivity.

@github-actions github-actions bot closed this Mar 9, 2023
@mohanarpit mohanarpit reopened this Mar 29, 2023
@mohanarpit mohanarpit changed the title Fix for using charset from response headers instead of default UTF-8 fix: Fix for using charset from response headers instead of default UTF-8 Mar 29, 2023
@mohanarpit
Copy link
Member

@balachandarsv Thank you for opening this PR. Apologies that it slipped through the cracks. I've reopened the PR and we'll work to merge this in. In the meantime, can I request you to please open a Github issue for this?

@@ -123,7 +124,11 @@ public Mono<ActionExecutionResult> triggerApiCall(WebClient client, HttpMethod h
*/
if (contentType.includes(MediaType.APPLICATION_JSON)) {
try {
String jsonBody = new String(body, StandardCharsets.UTF_8);
Charset charset = contentType.getCharset();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add a JUnit TC for this in the file RestApiPluginTest.java ?

Copy link
Author

Choose a reason for hiding this comment

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

Sure. Will do.

Copy link
Contributor

Choose a reason for hiding this comment

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

@balachandarsv please mention here once you are done.

Copy link
Author

Choose a reason for hiding this comment

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

Can you please check @sumitsum

@sumitsum
Copy link
Contributor

Hi @balachandarsv , please mention if you are still working on this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contributor Meant to track issues that are assigned to external contributors Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants