mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 17:26:03 +03:00
[GH-ISSUE #5133] [bug]: response.meta.size.body is always 0 (response size is lower then expected) #1956
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#1956
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 @jessedubbink on GitHub (Jun 6, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5133
Originally assigned to: @soumyamakkar on GitHub.
Is there an existing issue for this?
Current behavior
When I perform a request, I get a response but I noticed that the size is too low to be correct.
After debugging I noticed that the value of response.meta.size.body is always 0. But response.meta.size.headers does have value.
I expect response.meta.size.body to contain value, and the property .total to be the sum of .body and .headers properties.
Resulting in the correct display of the response size, in the result pane.
Steps to reproduce
(If I calculated it correctly the response body should be 1,715 bytes + 62 bytes from the response header.)
Logs and Screenshots
response.meta.size object in chrome devtools debugger
Environment
Production
Hoppscotch Version
Cloud
Interceptor
Not Applicable - Issue not related to network requests
Browsers Affected
Chrome
Operating System
Windows
Additional Information
@soumyamakkar commented on GitHub (Jun 10, 2025):
Hey, can I be assigned this issue
@CuriousCorrelation commented on GitHub (Jun 11, 2025):
Have assigned this to you @soumyamakkar - thanks for taking this on! 🚀 Feel free to reach out if you have any questions.
Just a heads up - each interceptor has its own way of calculating
metasince the underlying networking stack differs between them. You'll notice that not all interceptors are miscalculating the sizes (for example,Nativeon the Desktop App andAgenton the Web App calculate it correctly).I'd recommend starting by narrowing down interceptors that are experiencing this problem. Once you know that, you can dig into the specific interceptor code in
/packages/hoppscotch-common/src/platform/std/kernel-interceptors/and look for howbodySizeis calculated, then work your way up through the abstractions.@g3Bg2 commented on GitHub (Jun 11, 2025):
Exactly.
@soumyamakkar
The issue is that the web interceptor is likely using .length instead of .byteLength for ArrayBuffer responses, causing them to return 0 instead of the actual byte size.
@soumyamakkar commented on GitHub (Jun 11, 2025):
yep, I have fixed the issue for browser. looking for other interceptors that have this issue.
@soumyamakkar commented on GitHub (Jun 11, 2025):
@CuriousCorrelation commented on GitHub (Jun 11, 2025):
@soumyamakkar Total size of a simple echo response going beyond 5KB (shows 16.85KB) in your screenshot seems a bit excessive.
A good way to make sure the calculations are correct would be by using this simple
curlcommand:You can read more about it in the docs here: linux/man-pages/curl
Essentially the following from the docs:
and
so their addition would show you the total / expected response size.
This is what I see on my machine:
That looks correct and corresponds with
Nativeinterceptor's calculation ( +/- 100 bytes ) which is expected.@soumyamakkar commented on GitHub (Jun 11, 2025):
yep, you were right... think it is working fine now...
@soumyamakkar commented on GitHub (Jun 11, 2025):
so @CuriousCorrelation said that it works fine on agent and native, and I checked it works fine on extension, and I fixed it on browser as well
@soumyamakkar commented on GitHub (Jun 13, 2025):
I have fixed the logic in relay implementation, but this type error is blocking my commits, which is weird because I didn't make any modifications here, maybe it is because of some recent branches that got merged: packages/hoppscotch-common do-typecheck: src/services/persistence/validation-schemas/index.ts:579:39 - error TS2345: Argument of type 'ZodObject<{ name: ZodString; status: ZodString; code: ZodCatch<ZodNullable<ZodOptional<ZodUnion<[ZodLiteral, ZodLiteral, ...ZodLiteral[]]>>>>; headers: ZodArray<...>; body: ZodString; } & { ...; }, "strip", ZodTypeAny, { ...; }, { ...; }>' is not assignable to parameter of type 'VersionedEntity<any, any>'.
packages/hoppscotch-common do-typecheck: Type 'ZodObject<{ name: ZodString; status: ZodString; code: ZodCatch<ZodNullable<ZodOptional<ZodUnion<[ZodLiteral, ZodLiteral, ...ZodLiteral[]]>>>>; headers: ZodArray<...>; body: ZodString; } & { ...; }, "strip", ZodTypeAny, { ...; }, { ...; }>' is missing the following properties from type 'VersionedEntity<any, any>': versionMap, latestVersion, getVersion, is, and 3 more.
packages/hoppscotch-common do-typecheck: 579 response: entityReference(HoppRESTRequestResponse),
packages/hoppscotch-common do-typecheck: ~~~~~~~~~~~~~~~~~~~~~~~
packages/hoppscotch-common do-typecheck: Failed
C:\Users\Vansh\Desktop\DESKTOP\hoppscotch\packages\hoppscotch-common:
ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @hoppscotch/common@2025.5.2 do-typecheck:
node type-check.mjsExit status 1
@CuriousCorrelation commented on GitHub (Jun 16, 2025):
@soumyamakkar In response to your comment, I've posted info about the TypeScript error in the PR's comment
Let's keep further discussions about the PR in the PR's comment section to help with tracking. Thanks!
@jessedubbink commented on GitHub (Jun 20, 2025):
Fantastic!