Skip to content

Commit

Permalink
Update example/extend/Request.ts
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
fengmk2 and coderabbitai[bot] authored Dec 18, 2024
1 parent f0653f8 commit 949d4d0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions example/extend/Request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ export class CustomRequest extends Request {
if (this.app.proxy) {
host = '127.0.0.1';
}
host = host || this.get('host') || '';
this[HOST] = host = host.split(/\s*,\s*/)[0];
const rawHost = host || this.get('host');
if (!rawHost) {
this[HOST] = '';
return '';
}
this[HOST] = rawHost.split(/\s*,\s*/)[0];
return host;
}
}

0 comments on commit 949d4d0

Please sign in to comment.