mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] format
This commit is contained in:
parent
55ddb2ba48
commit
0a407c4326
2 changed files with 7 additions and 6 deletions
|
@ -63,8 +63,9 @@ export class NodeApp extends App {
|
|||
const protocol =
|
||||
req.headers['x-forwarded-proto'] ??
|
||||
('encrypted' in req.socket && req.socket.encrypted ? 'https' : 'http');
|
||||
const hostname = req.headers["x-forwarded-host"] ?? req.headers.host ?? req.headers[":authority"];
|
||||
const port = req.headers["x-forwarded-port"];
|
||||
const hostname =
|
||||
req.headers['x-forwarded-host'] ?? req.headers.host ?? req.headers[':authority'];
|
||||
const port = req.headers['x-forwarded-port'];
|
||||
const url = `${protocol}://${hostname}${port ? `:${port}` : ''}${req.url}`;
|
||||
const options: RequestInit = {
|
||||
method: req.method || 'GET',
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as assert from 'node:assert/strict';
|
||||
import { before, describe, it } from 'node:test';
|
||||
import { TLSSocket } from 'node:tls';
|
||||
import * as cheerio from 'cheerio';
|
||||
import nodejs from '../dist/index.js';
|
||||
import { createRequestAndResponse, loadFixture } from './test-utils.js';
|
||||
import * as cheerio from 'cheerio';
|
||||
|
||||
describe('URL', () => {
|
||||
/** @type {import('./test-utils.js').Fixture} */
|
||||
|
@ -78,8 +78,8 @@ describe('URL', () => {
|
|||
let { req, res, text } = createRequestAndResponse({
|
||||
headers: {
|
||||
'X-Forwarded-Proto': 'https',
|
||||
'X-Forwarded-Host': 'abc.xyz',
|
||||
'X-Forwarded-Port': '444'
|
||||
'X-Forwarded-Host': 'abc.xyz',
|
||||
'X-Forwarded-Port': '444',
|
||||
},
|
||||
url: '/',
|
||||
});
|
||||
|
@ -90,6 +90,6 @@ describe('URL', () => {
|
|||
const html = await text();
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.equal($('body').text(), "https://abc.xyz:444/");
|
||||
assert.equal($('body').text(), 'https://abc.xyz:444/');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue