mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
[ci] format
This commit is contained in:
parent
e96bcae535
commit
116c533596
2 changed files with 4 additions and 4 deletions
|
@ -84,10 +84,11 @@ export class NodeApp extends App {
|
|||
|
||||
// @example "443,8080,80" => "443"
|
||||
const forwardedPort = getFirstForwardedValue(req.headers['x-forwarded-port']);
|
||||
const port = forwardedPort ?? req.socket?.remotePort?.toString() ?? (isEncrypted ? '443' : '80');
|
||||
const port =
|
||||
forwardedPort ?? req.socket?.remotePort?.toString() ?? (isEncrypted ? '443' : '80');
|
||||
|
||||
const portInHostname = typeof hostname === 'string' && /:\d+$/.test(hostname);
|
||||
const hostnamePort = portInHostname ? hostname : `${hostname}:${port}`
|
||||
const hostnamePort = portInHostname ? hostname : `${hostname}:${port}`;
|
||||
|
||||
const url = `${protocol}://${hostnamePort}${req.url}`;
|
||||
const options: RequestInit = {
|
||||
|
|
|
@ -158,7 +158,6 @@ describe('NodeApp', () => {
|
|||
assert.equal(result.url, 'https://example.com:3000/');
|
||||
});
|
||||
|
||||
|
||||
it('prefers port from x-forwarded-host', () => {
|
||||
const result = NodeApp.createRequest({
|
||||
...mockNodeRequest,
|
||||
|
|
Loading…
Reference in a new issue