-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
inspector: add mimeType and charset support to Network.Response #58192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
common.mustCall(({ params }) => { | ||
assert.strictEqual(params.response.mimeType, ''); | ||
assert.strictEqual(params.response.charset, ''); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the Content-Type header is not set, Chromium also assigns an empty string.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #58192 +/- ##
==========================================
+ Coverage 90.15% 90.21% +0.06%
==========================================
Files 630 633 +3
Lines 186756 186878 +122
Branches 36652 36685 +33
==========================================
+ Hits 168361 168599 +238
+ Misses 11192 11065 -127
- Partials 7203 7214 +11
🚀 New features to boost your workflow:
|
const contentType = contentTypeKeyIndex !== -1 ? response.headers[contentTypeKeyIndex + 1].toString() : ''; | ||
const mimeTypeObj = new MIMEType(contentType); | ||
mimeType = mimeTypeObj.essence || ''; | ||
charset = mimeTypeObj.params.get('charset'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Charset can be undefined/null if this does not exist. I don't think we want that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I overlooked this case.
Like mimeType, I’ve set it to an empty string.
}) | ||
); | ||
}), | ||
2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems indented out of order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why, but when I add a line break, eslint complains about the indent.
For now, I’ve just passed the second argument without breaking it into a new line.
Refs: #53946
It supports the mimeType and charset defined in Network.Response.
https://chromedevtools.github.io/devtools-protocol/tot/Network/#type-Response