Skip to content

Commit

Permalink
Add inspect symbol for request
Browse files Browse the repository at this point in the history
WIP
  • Loading branch information
Kikobeats committed Jul 22, 2022
1 parent 0f99768 commit 573aa6b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/next/server/web/spec-extension/cookies.ts
Expand Up @@ -55,6 +55,9 @@ export class Cookies extends Map<string, string> {
)
)
}
[Symbol.for('edge-runtime.inspect.custom')]() {
return Object.fromEntries(this.entries())
}
}

export class NextCookies extends Cookies {
Expand Down
24 changes: 24 additions & 0 deletions packages/next/server/web/spec-extension/request.ts
Expand Up @@ -31,6 +31,30 @@ export class NextRequest extends Request {
}
}

[Symbol.for('edge-runtime.inspect.custom')]() {
return {
cookies: this.cookies,
geo: this.geo,
ip: this.ip,
nextUrl: this.nextUrl,
url: this.url,
// rest of props come from Request
bodyUsed: this.bodyUsed,
cache: this.cache,
credentials: this.credentials,
destination: this.destination,
headers: Object.fromEntries(this.headers),
integrity: this.integrity,
keepalive: this.keepalive,
method: this.method,
mode: this.mode,
redirect: this.redirect,
referrer: this.referrer,
referrerPolicy: this.referrerPolicy,
signal: this.signal,
}
}

public get cookies() {
return this[INTERNALS].cookies
}
Expand Down

0 comments on commit 573aa6b

Please sign in to comment.