[PR #5652] [MERGED] feat(common): create and manage example responses in collections #5304

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

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5652
Author: @anwarulislam
Created: 12/3/2025
Status: Merged
Merged: 12/19/2025
Merged by: @jamesgeorge007

Base: nextHead: feat/add-example


📝 Commits (5)

  • 927b19c feat: add functionality to create and manage example responses in collections
  • 4ab7d09 feat: add validation for request data in addExample function
  • bf09895 feat: enhance example response creation with original request handling
  • 27734d1 fix: add error.invalid_request locale and guard undefined responses in add-example flow
  • e38d2be fix: avoid JSONC strip crash on empty bodies

📊 Changes

6 files changed (+328 additions, -4 deletions)

View changed files

📝 packages/hoppscotch-common/locales/en.json (+4 -1)
📝 packages/hoppscotch-common/src/components/collections/MyCollections.vue (+16 -0)
📝 packages/hoppscotch-common/src/components/collections/Request.vue (+17 -0)
📝 packages/hoppscotch-common/src/components/collections/TeamCollections.vue (+16 -0)
📝 packages/hoppscotch-common/src/components/collections/index.vue (+268 -1)
📝 packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts (+7 -2)

📄 Description

Introduce the ability to create and validate example responses within collections, enhancing the request management experience. This includes a new modal for adding examples and validation for request data.

Preview

Request level context menu addition

image

Summary by cubic

Adds the ability to create and save example responses for collection requests, improving request documentation and reuse. Works for both personal and team collections with validation and persistence.

  • New Features

    • Add “Add example” modal to name and save example responses.
    • New request context-menu action with shortcut “A”.
    • Supports My and Team collections; persists via local edit or GraphQL update.
    • Validates request data and duplicate names; shows error toasts, includes original request snapshot.
    • Opens the saved example in a new tab and updates open request tabs; adds i18n strings.
  • Bug Fixes

    • Prevent JSON body parse crash on empty body when content-type is JSON (avoids send spinner lock).
    • Add missing invalid-request i18n key and guard undefined responses in the add-example flow.

Written for commit e38d2be60d. Summary will update automatically on new commits.


🔄 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/5652 **Author:** [@anwarulislam](https://github.com/anwarulislam) **Created:** 12/3/2025 **Status:** ✅ Merged **Merged:** 12/19/2025 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `next` ← **Head:** `feat/add-example` --- ### 📝 Commits (5) - [`927b19c`](https://github.com/hoppscotch/hoppscotch/commit/927b19c3479536d8c9e3dcccfc855dd43d6bdb68) feat: add functionality to create and manage example responses in collections - [`4ab7d09`](https://github.com/hoppscotch/hoppscotch/commit/4ab7d090862a4d02edca5474d1c96abf6ab10930) feat: add validation for request data in addExample function - [`bf09895`](https://github.com/hoppscotch/hoppscotch/commit/bf098952bc7d3d8008fcf7999d462f60a99892d9) feat: enhance example response creation with original request handling - [`27734d1`](https://github.com/hoppscotch/hoppscotch/commit/27734d101f63c3eece7705a8c514c930325cd77e) fix: add `error.invalid_request` locale and guard `undefined` responses in add-example flow - [`e38d2be`](https://github.com/hoppscotch/hoppscotch/commit/e38d2be60d86a88afdb0599a5fa0de03c6b4275b) fix: avoid JSONC strip crash on empty bodies ### 📊 Changes **6 files changed** (+328 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/locales/en.json` (+4 -1) 📝 `packages/hoppscotch-common/src/components/collections/MyCollections.vue` (+16 -0) 📝 `packages/hoppscotch-common/src/components/collections/Request.vue` (+17 -0) 📝 `packages/hoppscotch-common/src/components/collections/TeamCollections.vue` (+16 -0) 📝 `packages/hoppscotch-common/src/components/collections/index.vue` (+268 -1) 📝 `packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts` (+7 -2) </details> ### 📄 Description Introduce the ability to create and validate example responses within collections, enhancing the request management experience. This includes a new modal for adding examples and validation for request data. ### Preview > Request level context menu addition <img width="545" height="340" alt="image" src="https://github.com/user-attachments/assets/cb7b5b89-b150-4f6d-ae12-629e6b295510" /> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds the ability to create and save example responses for collection requests, improving request documentation and reuse. Works for both personal and team collections with validation and persistence. - **New Features** - Add “Add example” modal to name and save example responses. - New request context-menu action with shortcut “A”. - Supports My and Team collections; persists via local edit or GraphQL update. - Validates request data and duplicate names; shows error toasts, includes original request snapshot. - Opens the saved example in a new tab and updates open request tabs; adds i18n strings. - **Bug Fixes** - Prevent JSON body parse crash on empty body when content-type is JSON (avoids send spinner lock). - Add missing invalid-request i18n key and guard undefined responses in the add-example flow. <sup>Written for commit e38d2be60d86a88afdb0599a5fa0de03c6b4275b. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:45:49 +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#5304
No description provided.