Skip to content

Json ContentType with ;charset=utf-8 is not recognized #80

@keraton

Description

@keraton

Hello,

While I'm testing my application, I found out that the result is not shown in the response view because the type is not json but application/json;charset=utf-8

So created a patch that can fix it:

Index: src/core/http_client/client.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/core/http_client/client.ts b/src/core/http_client/client.ts
--- a/src/core/http_client/client.ts	(revision 521b4ac5069fb5d748edf2f373b6cd5f5bc5dceb)
+++ b/src/core/http_client/client.ts	(date 1642675334155)
@@ -47,7 +47,7 @@
   if (buf.length === 0) {
     responseBodyType = 'empty';
     responseBodyValue = undefined;
-  } else if (saidContentType === CONTENT_TYPE_JSON) {
+  } else if (saidContentType?.includes(CONTENT_TYPE_JSON)) {
     responseBodyType = 'json';
     responseBodyValue = toJson(buf);
   } else if (saidContentType?.includes(CONTENT_TYPE_HTML)) {


This will recognize CONTENT_TYPE_JSON

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions