Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f5a1df6
chore: small fixes to tests
jasonsaayman Feb 27, 2026
7426abd
feat: transitional move to vitests
jasonsaayman Mar 1, 2026
7976db1
feat: moving unit tests in progress
jasonsaayman Mar 1, 2026
00f4d5f
feat: moving more unit tests over
jasonsaayman Mar 1, 2026
e65b0f2
feat: more tests moved
jasonsaayman Mar 2, 2026
e4219a4
feat: updated more sections of the http test
jasonsaayman Mar 3, 2026
6d83cf4
chore: wip http tests
jasonsaayman Mar 4, 2026
f36988c
chore: wip http tests
jasonsaayman Mar 5, 2026
c11bf72
chore: more http tests
jasonsaayman Mar 5, 2026
9a8d9a7
chore: tests
jasonsaayman Mar 5, 2026
02b9659
chore: tests
jasonsaayman Mar 5, 2026
19647cc
chore: tests
jasonsaayman Mar 5, 2026
6666650
chore: tests
jasonsaayman Mar 5, 2026
470f8dd
chore: tests
jasonsaayman Mar 5, 2026
695f282
chore: tests
jasonsaayman Mar 6, 2026
4b957ec
chore: tests
jasonsaayman Mar 6, 2026
a0de634
chore: tests
jasonsaayman Mar 6, 2026
f71456a
chore: tests
jasonsaayman Mar 6, 2026
4e101d7
chore: tests
jasonsaayman Mar 6, 2026
5c8dfe2
chore: tests
jasonsaayman Mar 6, 2026
6b63218
chore: tests
jasonsaayman Mar 6, 2026
7d719c2
chore: tests
jasonsaayman Mar 6, 2026
daada61
chore: tests
jasonsaayman Mar 6, 2026
8ab0e45
chore: tests
jasonsaayman Mar 6, 2026
9f8a759
chore: tests
jasonsaayman Mar 6, 2026
503ffd2
chore: tests
jasonsaayman Mar 6, 2026
ff57959
chore: tests
jasonsaayman Mar 6, 2026
91350f1
chore: tests
jasonsaayman Mar 6, 2026
28a096d
chore: tests
jasonsaayman Mar 6, 2026
72558ce
chore: tests
jasonsaayman Mar 6, 2026
c50fec5
chore: tests
jasonsaayman Mar 6, 2026
908e735
chore: tests
jasonsaayman Mar 6, 2026
db6f451
chore: tests
jasonsaayman Mar 6, 2026
8f52b54
chore: tests
jasonsaayman Mar 6, 2026
12880b9
chore: remove un-needed docs
jasonsaayman Mar 6, 2026
30fa966
Merge branch 'v1.x' into feat/update-testing-flows
jasonsaayman Mar 6, 2026
d5de8a9
chore: update package lock
jasonsaayman Mar 6, 2026
1cf5415
chore: update lock
jasonsaayman Mar 6, 2026
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
chore: tests
  • Loading branch information
jasonsaayman committed Mar 5, 2026
commit 470f8dd61a4a705eb6b7a4d8047ce97a83b5fca7
40 changes: 39 additions & 1 deletion tests/unit/adapters/http.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it } from 'vitest';
import assert from 'assert';
import { startHTTPServer, stopHTTPServer } from '../../setup/server.js';
import { startHTTPServer, stopHTTPServer, generateReadable } from '../../setup/server.js';
import axios from '../../../index.js';
import AxiosError from '../../../lib/core/AxiosError.js';
import http from 'http';
Expand All @@ -10,6 +10,7 @@ import url from 'url';
import zlib from 'zlib';
import fs from 'fs';
import path from 'path';
import devNull from 'dev-null';

describe('supports http with nodejs', () => {
const adaptersTestsDir = path.join(process.cwd(), 'tests/unit/adapters');
Expand Down Expand Up @@ -833,5 +834,42 @@ describe('supports http with nodejs', () => {
await stopHTTPServer(server);
}
});

it('should destroy the response stream with an error on request stream destroying', async () => {
const server = await startHTTPServer();
const requestStream = generateReadable();

setTimeout(() => {
requestStream.destroy();
}, 1000);

const { data } = await axios.post(`http://localhost:${server.address().port}/`, requestStream, {
responseType: 'stream',
});

let streamError;
data.on('error', (error) => {
streamError = error;
});

try {
await new Promise((resolve, reject) => {
stream.pipeline(data, devNull(), (error) => {
if (error) {
reject(error);
return;
}

resolve();
});
});
assert.fail('stream was not aborted');
} catch (error) {
// Expected: the request stream is destroyed before completion.
} finally {
assert.strictEqual(streamError && streamError.code, 'ERR_CANCELED');
await stopHTTPServer(server);
}
});
});
});