mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 08:45:58 +03:00
[GH-ISSUE #5980] [feature]: Mock Server — Variable resolution and dynamic response body substitution #2351
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#2351
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?
Originally created by @ajsead on GitHub (Mar 13, 2026).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5980
Is there an existing issue for this?
Summary
Currently the Mock Server matches requests and returns static response bodies. There is no support for variable substitution in response bodies, and query parameters containing Hoppscotch variable syntax (
<<variable>>) are never treated as wildcards during example matching — causing valid examples to fail to match incoming requests.x-mock-response-nameheader to bypass scoring — works as a workaround but requires hardcoding example names in every requestSecond, response bodies are always static — there is no variable substitution, so request values like path variables, query params, or body fields can never be reflected back in the response. This makes the mock server impractical for simulating realistic dynamic API behavior.
Why should this be worked on?
Two concrete problems today:
1. Query param matching breaks with variables
If an example endpoint is defined as:
The value
<<query>>is compared literally against the actual request value (e.g.shoes), resulting in apartialMatchespenalty and potentially a zero score. The example is never selected.2. Response body is always static
formatExampleResponsereturnsresponseBodyas-is with no substitution. There is no way to reflect request values (path variables, query params, body fields) back in the response, making the mock server less useful for dynamic API simulation.