Skip to content
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

fetch: improve util.inspect output for web specifications #2938

Merged
merged 3 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: test repair
  • Loading branch information
Mert Can Altin committed Mar 10, 2024
commit 10f46e8737913f0785b86b21540abf3a816990f3
2 changes: 1 addition & 1 deletion lib/web/fetch/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ class Headers {

[util.inspect.custom] (depth, options) {
const inspected = util.inspect(this[kHeadersList].entries)

return `Headers ${inspected}`
}
}
Expand Down
7 changes: 3 additions & 4 deletions test/fetch/headers-inspect-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@

test('Headers class custom inspection', () => {
const headers = new Headers()
headers.set('content-Type', 'application/json')
headers.set('authorization', 'Bearer token')
headers.set('Content-Type', 'application/json')
headers.set('Authorization', 'Bearer token')
Dismissed Show dismissed Hide dismissed

const inspectedOutput = util.inspect(headers, { depth: 1 })

const expectedOutput =
'Headers:\nContent-Type: application/json\nAuthorization: Bearer token'
const expectedOutput = "Headers { 'Content-Type': 'application/json', Authorization: 'Bearer token' }"
assert.strictEqual(inspectedOutput, expectedOutput)
})
Loading