Skip to content

Commit 1322da4

Browse files
committed
Add more logging around route matching
1 parent e100fe6 commit 1322da4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/http-handler.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ function createHttpRequestHandler(options: {
6767
: undefined;
6868

6969
if (path === '/' && (!hostnamePrefix || hostnamePrefix === 'www')) {
70+
console.log(`Request to root page at ${path}${
71+
hostnamePrefix
72+
? ` ('${hostnamePrefix}' prefix)`
73+
: ` (${options.rootDomain})`
74+
}`);
7075
res.writeHead(307, {
7176
location: 'https://github.com/httptoolkit/testserver/'
7277
});
@@ -90,7 +95,7 @@ function createHttpRequestHandler(options: {
9095
if (matchingEndpoint) {
9196
console.log(`Request to ${path}${
9297
hostnamePrefix
93-
? ` (${hostnamePrefix} prefix)`
98+
? ` ('${hostnamePrefix}' prefix)`
9499
: ` (${options.rootDomain})`
95100
} matched endpoint ${matchingEndpoint.name}`);
96101
await matchingEndpoint.handle(req, res, {

0 commit comments

Comments
 (0)