fix: preserve raw request data to fix [object Object] display issue#61
Merged
GrinZero merged 3 commits intoGrinZero:mainfrom Apr 20, 2026
Merged
fix: preserve raw request data to fix [object Object] display issue#61GrinZero merged 3 commits intoGrinZero:mainfrom
GrinZero merged 3 commits intoGrinZero:mainfrom
Conversation
- Remove unnecessary JSON.parse in request.ts, keep original data format - Simplify postData handling in index.ts, let DevTools parse JSON itself - Fixes issue where text/plain requests with JSON body showed [object Object]
Owner
|
👋 Hello, can you post some screenshots and test cases? I'm not sure which case needs to be fixed like this |
Owner
I tried to start the koa-esm project and requested http://127.0.0.1:3001/post. This is the result. |
Owner
|
I don't know what case you are using.
postData: (() => {
const data = request.requestData
if (Buffer.isBuffer(data)) {
return data.toString('utf-8')
}
if (data?. type === 'Buffer' && Array.isArray(data.data)) {
return Buffer.from(data.data).toString('utf-8')
}
if (typeof data === 'string') {
return data
}
return JSON.stringify(data)
})() |
- Remove MAX_REQUEST_DATA_SIZE limit to capture complete request data - Convert Buffer/object to string in write() to avoid IPC serialization issues - Accumulate multiple write calls for multipart/form-data support - Add test cases for various POST body types (text/plain, form, buffer)
Author
|
感谢指出这个问题! 本次修复主要做了以下改动:
麻烦再帮忙检查一下是否还有其他问题,感谢! Thanks for pointing out this issue! This fix includes the following changes:
Please help check if there are any other issues. Thanks! |
GrinZero
approved these changes
Apr 20, 2026
Owner
|
has been merged. By the way, can SSE also be optimized? |
Author
|
I'll work on it today 🌹 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
When sending HTTP requests with
text/plainContent-Type but JSON body (e.g., some logging SDKs), the DevTools Network panel shows[object Object]instead of the actual request payload.Root Cause
In
request.ts, the code unnecessarily parses the request data withJSON.parse(), converting the string to an object. Later inindex.ts, when building the CDPpostDatafield, it only re-serializes forapplication/jsonContent-Type, leavingtext/plainrequests with an object that becomes[object Object].Solution
JSON.parse()inrequest.ts, keep raw data formatpostDatahandling inindex.tsto always use.toString()Changes
packages/network-debugger/src/core/request.ts: Remove JSON.parse, preserve original datapackages/network-debugger/src/fork/module/network/index.ts: Simplify torequest.requestData.toString()