mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #4957] [bug]: Inconsistent Response Body Type Handling Between Hopp CLI and Hoppscotch Web UI #1874
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#1874
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 @rajkumar-cp on GitHub (Apr 4, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4957
Is there an existing issue for this?
Current behavior
A test script that works successfully when executed from the Hoppscotch web UI fails with a SyntaxError when run from the CLI. The error message indicates that "[object Object]" is not valid JSON.
Steps to reproduce
Logs and Screenshots
Environment
Production
Hoppscotch Version
Self-Hosted (v2025.2.3)
Interceptor
Extension - Web App
Browsers Affected
Chrome
Operating System
Windows
Additional Information
Sample response which i am trying to validate
{
"TransactionID": "eb8d75d0",
"ResponseDate": "2025-04-04",
"ResponseTime": "14:01:03",
"Company": [
{
"BusinessPartnerID": "e327c8d1-15bc",
"Error": ""
}
]
}
Sample test which works fine in both web and CLI
// Checking if the status code of the request is 200 (successful)
pw.test("Status code is 200", () => {
pw.expect(pw.response.status).toBe(200);
});
// Checking if the TransactionID is returned in the response
pw.test("TransactionID should not be empty", () => {
pw.expect(pw.response.body.TransactionID).not.toBe("");
});
Sample test which works fine in web and fails in CLI
// Storing the response from the api call as Response, the company's BusinessPartnerID stored as CBPID
const Response = JSON.parse(pw.response.body);
const CBPID = Response.Company[0].BusinessPartnerID;
//Setting the environment variable CBPID with the value received in the response
pw.env.set("CBPID", CBPID);
//Checking if the status code of the request is 200 (successful)
pw.test("Status code is 200", ()=> {
pw.expect(pw.response.status).toBe(200);
});
//Checking if the TransactionID is returned in the response
pw.test("TransactionID should not be empty", () => {
pw.expect(Response.TransactionID).not.toBe("");
});
//Checking if the error field in the response is empty
pw.test("Error should be empty", () => {
pw.expect(Response.Company[0].Error).toBe("");
});
@muellerst-hg commented on GitHub (Apr 9, 2025):
I could reproduce with the following scenario:
Therefore the following line in your Tests fail in cli but succeed in web ui:
IMO both web ui and cli should behave like the same.
@muellerst-hg commented on GitHub (Apr 9, 2025):
A workaround could be:
or try changing content-type to "application/json" in the http reponse header.
@rajkumar-cp commented on GitHub (Apr 9, 2025):
Thanks @muellerst-hg this helped me.
Changing the bug title to make more sense.
@Red44 commented on GitHub (Sep 12, 2025):
I have the same issues for the webui, where octet-streams content is sent as just "[object Object]" and also there seems to be an error, when requesting the shell curl command for that request. I can also confirm that the "[object Object]" response is a regression from at least version 2024.9.3