Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keep statusMessage alias to statusText on response.res object #491

Merged
merged 13 commits into from
Feb 29, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
f
fengmk2 committed Feb 29, 2024
commit c9d032a5625fc038ff2cdc4cbfe8e2e2579aecd0
9 changes: 6 additions & 3 deletions test/keep-alive-header.test.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import { strict as assert } from 'node:assert';
import { describe, it, beforeAll, afterAll } from 'vitest';
import { HttpClient } from '../src';
import { startServer } from './fixtures/server';
import { sleep } from './utils';
import { isWindows, nodeMajorVersion, sleep } from './utils';

describe('keep-alive-header.test.ts', () => {
// should shorter than server keepalive timeout
@@ -33,8 +33,11 @@ describe('keep-alive-header.test.ts', () => {
const task = httpClient.request(_url);
console.log('after request stats: %o', httpClient.getDispatcherPoolStats());
if (httpClient.getDispatcherPoolStats()[origin]) {
assert.equal(httpClient.getDispatcherPoolStats()[origin].pending, 1);
assert.equal(httpClient.getDispatcherPoolStats()[origin].size, 1);
if (!(nodeMajorVersion() === 14 || isWindows())) {
// ignore node = 14 & windows
assert.equal(httpClient.getDispatcherPoolStats()[origin].pending, 1);
assert.equal(httpClient.getDispatcherPoolStats()[origin].size, 1);
}
}
let response = await task;
console.log('after response stats: %o', httpClient.getDispatcherPoolStats());
4 changes: 2 additions & 2 deletions test/options.socketPath.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { strict as assert } from 'node:assert';
import os from 'node:os';
import { describe, it, beforeAll, afterAll } from 'vitest';
import urllib from '../src';
import { startServer } from './fixtures/socket_server';
import { isWindows } from './utils';

describe.skipIf(os.platform() === 'win32')('options.socketPath.test.ts', () => {
describe.skipIf(isWindows())('options.socketPath.test.ts', () => {
let close: any;
let _url: string;
let _socketPath: string;
6 changes: 5 additions & 1 deletion test/utils.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import { Readable } from 'node:stream';
import { ReadableStream } from 'node:stream/web';
import { rm, writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { tmpdir, platform } from 'node:os';
import { randomUUID } from 'node:crypto';

export async function sleep(ms: number) {
@@ -44,3 +44,7 @@ export async function createTempfile(content?: Buffer | string) {
export function nodeMajorVersion() {
return parseInt(process.versions.node.split('.')[0]);
}

export function isWindows() {
return platform() === 'win32';
}
5 changes: 0 additions & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -12,10 +12,5 @@ export default defineConfig({
],
},
pool: 'threads',
poolOptions: {
forks: {
isolate: false,
},
},
},
});