forked from nodejs/undici
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fetch: improve util.inspect output for web specifications (nodejs#2938)
- Loading branch information
1 parent
e6fad1d
commit 0708c96
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict' | ||
|
||
const { Headers } = require('../../lib/web/fetch/headers') | ||
const { test } = require('node:test') | ||
const assert = require('node:assert') | ||
const util = require('util') | ||
|
||
test('Headers class custom inspection', () => { | ||
const headers = new Headers() | ||
headers.set('Content-Type', 'application/json') | ||
headers.set('Authorization', 'Bearer token') | ||
|
||
const inspectedOutput = util.inspect(headers, { depth: 1 }) | ||
|
||
const expectedOutput = "Headers { 'Content-Type': 'application/json', Authorization: 'Bearer token' }" | ||
assert.strictEqual(inspectedOutput, expectedOutput) | ||
}) |