mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[PR #5524] [MERGED] chore: mock server name validation and prevent duplicates #5241
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5241
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5524
Author: @mirarifhasan
Created: 10/29/2025
Status: ✅ Merged
Merged: 10/29/2025
Merged by: @nahidhasan94
Base:
next← Head:fix/mock-server-backend-followup📝 Commits (3)
2a963a3chore: mock server name validation and prevent duplicatesc0642d3refactor: mock server name validation patterncdf3713chore: remove duplicate mock server collection check📊 Changes
1 file changed (+16 additions, -3 deletions)
View changed files
📝
packages/hoppscotch-backend/src/mock-server/mock-server.model.ts(+16 -3)📄 Description
Closes #
What's changed
This pull request introduces improved validation and error handling for mock server creation and updates in the backend. The most significant changes are the relaxed name validation rules for mock servers and the addition of a check to prevent duplicate mock servers for the same collection.
Validation improvements:
namefield in bothCreateMockServerInputandUpdateMockServerInputclasses: replaced@IsAlphanumeric()with@Matches(/^[a-zA-Z0-9 ._-]+$/)to allow spaces, dots, underscores, and hyphens, and added@IsString()for type safety. [1] [2] [3]Error handling enhancements:
MockServerServiceto prevent creating a mock server with a collection ID that already exists and is not deleted, returning aMOCK_SERVER_ALREADY_EXISTSerror if found. [1] [2]Notes to reviewers
Nil
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.