[PR #4402] [MERGED] fix: comments being stripped out of json request body #4788

Closed
opened 2026-03-17 02:17:35 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/4402
Author: @AndrewBastin
Created: 10/4/2024
Status: Merged
Merged: 10/4/2024
Merged by: @jamesgeorge007

Base: patchHead: fix/jsonc-strip


📝 Commits (2)

  • 5dd5d13 fix: jsonc accidentally stripping urls out as comments
  • 25c105b refactor: change the impl to use jsonc-parser library

📊 Changes

3 files changed (+13 additions, -17 deletions)

View changed files

📝 packages/hoppscotch-common/package.json (+1 -0)
📝 packages/hoppscotch-common/src/helpers/editor/linting/jsonc.ts (+2 -16)
📝 pnpm-lock.yaml (+10 -1)

📄 Description

This PR intends to fix the issue where the new JSONC system strips parts of URLs when it strips comments.

The removeComments function converts the following string erroneously:
Input:

{
  "hello": "https://echo.hoppscotch.io"
}

Output:

{
  "hello": "https
}

What's changed

  1. Add jsonc-parser NPM package as a dependency
  2. Use jsonc-parser implementation to strip comments instead of the current implementation.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/4402 **Author:** [@AndrewBastin](https://github.com/AndrewBastin) **Created:** 10/4/2024 **Status:** ✅ Merged **Merged:** 10/4/2024 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `patch` ← **Head:** `fix/jsonc-strip` --- ### 📝 Commits (2) - [`5dd5d13`](https://github.com/hoppscotch/hoppscotch/commit/5dd5d13ac51785d2b6e1c6101904ac411d5599d7) fix: jsonc accidentally stripping urls out as comments - [`25c105b`](https://github.com/hoppscotch/hoppscotch/commit/25c105b1b07ce580e79e8d234a5d788eb36bf1d5) refactor: change the impl to use jsonc-parser library ### 📊 Changes **3 files changed** (+13 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/package.json` (+1 -0) 📝 `packages/hoppscotch-common/src/helpers/editor/linting/jsonc.ts` (+2 -16) 📝 `pnpm-lock.yaml` (+10 -1) </details> ### 📄 Description This PR intends to fix the issue where the new JSONC system strips parts of URLs when it strips comments. The `removeComments` function converts the following string erroneously: Input: ```json { "hello": "https://echo.hoppscotch.io" } ``` Output: ``` { "hello": "https } ``` ### What's changed 1. Add `jsonc-parser` NPM package as a dependency 2. Use `jsonc-parser` implementation to strip comments instead of the current implementation. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:17:35 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#4788
No description provided.