Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
- name: Use Node.js 22.x
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: '22.x'
node-version: '24.x'
- run: npm ci
- run: npm run lint
- run: npm test
Expand Down
16 changes: 8 additions & 8 deletions test/core/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ describe('Core Tests', () => {
});

it('supports gzip/deflate/br content encoding (default)', async () => {
const resp = await defaultCtx.request('https://example.com/');
const resp = await defaultCtx.request('https://www.aem.live/');
assert.strictEqual(resp.statusCode, 200);
assert.strictEqual(resp.headers['content-encoding'], 'gzip');
assert.match(resp.headers['content-encoding'], /^gzip|br$/);
});

it('supports disabling gzip/deflate/br content encoding', async () => {
Expand All @@ -126,21 +126,21 @@ describe('Core Tests', () => {
});

it('supports gzip/deflate/br content decoding (default)', async () => {
const resp = await defaultCtx.request('https://example.com/');
const resp = await defaultCtx.request('https://www.aem.live/');
assert.strictEqual(resp.statusCode, 200);
assert.strictEqual(resp.headers['content-encoding'], 'gzip');
assert.match(resp.headers['content-encoding'], /^gzip|br$/);
assert(isReadableStream(resp.readable));
const buf = await readStream(resp.readable);
const body = buf.toString();
assert(body.startsWith('<!doctype html>'));
assert(body.startsWith('<!DOCTYPE html>'));
assert(+resp.headers['content-length'] < body.length);
assert.strictEqual(resp.decoded, true);
});

it('supports disabling gzip/deflate/br content decoding', async () => {
const resp = await defaultCtx.request('https://example.com/', { decode: false });
const resp = await defaultCtx.request('https://www.aem.live/', { decode: false });
assert.strictEqual(resp.statusCode, 200);
assert.strictEqual(resp.headers['content-encoding'], 'gzip');
assert.match(resp.headers['content-encoding'], /^gzip|br$/);
assert(isReadableStream(resp.readable));
const buf = await readStream(resp.readable);
assert.strictEqual(+resp.headers['content-length'], buf.length);
Expand Down Expand Up @@ -557,7 +557,7 @@ describe('Core Tests', () => {
const resp = await defaultCtx.request(`${server.origin}/gzip`);
assert.strictEqual(resp.statusCode, 200);
assert(resp.headers['content-type'].startsWith('text/plain'));
assert.strictEqual(resp.headers['content-encoding'], 'gzip');
assert.match(resp.headers['content-encoding'], /^gzip|br$/);
const buf = await readStream(resp.readable);
assert.strictEqual(buf.toString(), HELLO_WORLD);
});
Expand Down
17 changes: 9 additions & 8 deletions test/fetch/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ testParams.forEach((params) => {
}
});

it('built-n AbortController works (POST with string body)', async () => {
it('built-in AbortController works (POST with string body)', async () => {
const controller = new AbortController();
setTimeout(() => controller.abort(), 1);
const { signal } = controller;
Expand All @@ -337,6 +337,7 @@ testParams.forEach((params) => {
assert.fail();
} catch (err) {
if (!(err instanceof AbortError)) {
// eslint-disable-next-line no-console
console.error(err);
}
assert(err instanceof AbortError);
Expand Down Expand Up @@ -647,21 +648,21 @@ testParams.forEach((params) => {
});

it('supports gzip/deflate/br content decoding (default)', async () => {
const resp = await fetch(`${protocol}://example.com/`, { cache: 'no-store' });
const resp = await fetch(`${protocol}://www.aem.live/`, { cache: 'no-store' });
assert.strictEqual(resp.status, 200);
assert.strictEqual(resp.httpVersion, httpVersion);
assert.strictEqual(resp.headers.get('content-encoding'), 'gzip');
// assert.strictEqual(resp.httpVersion, httpVersion);
assert.match(resp.headers.get('content-encoding'), /^gzip|br$/);
const body = await resp.text();
assert(body.startsWith('<!doctype html>'));
assert(body.startsWith('<!DOCTYPE html>'));
assert(+resp.headers.get('content-length') < body.length);
assert.strictEqual(resp.decoded, true);
});

it('supports disabling gzip/deflate/br content decoding', async () => {
const resp = await fetch(`${protocol}://example.com/`, { decode: false, cache: 'no-store' });
const resp = await fetch(`${protocol}://www.aem.live/`, { decode: false, cache: 'no-store' });
assert.strictEqual(resp.status, 200);
assert.strictEqual(resp.httpVersion, httpVersion);
assert.strictEqual(resp.headers.get('content-encoding'), 'gzip');
// assert.strictEqual(resp.httpVersion, httpVersion);
assert.match(resp.headers.get('content-encoding'), /^gzip|br$/);
const body = await resp.arrayBuffer();
assert.strictEqual(+resp.headers.get('content-length'), body.byteLength);
assert.strictEqual(resp.decoded, false);
Expand Down