forked from axios/axios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bugs.js
43 lines (36 loc) · 1.42 KB
/
bugs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import assert from 'assert';
import http from 'http';
import axios from '../../../index.js';
describe('issues', function () {
describe('4999', function () {
it('should not fail with query parsing', async function () {
const {data} = await axios.get('https://postman-echo.com/get?foo1=bar1&foo2=bar2');
assert.strictEqual(data.args.foo1, 'bar1');
assert.strictEqual(data.args.foo2, 'bar2');
});
});
describe('5028', function () {
it('should handle set-cookie headers as an array', async function () {
const cookie1 = 'something=else; path=/; expires=Wed, 12 Apr 2023 12:03:42 GMT; samesite=lax; secure; httponly';
const cookie2 = 'something-ssr.sig=n4MlwVAaxQAxhbdJO5XbUpDw-lA; path=/; expires=Wed, 12 Apr 2023 12:03:42 GMT; samesite=lax; secure; httponly';
const server = http.createServer((req, res) => {
//res.setHeader('Set-Cookie', 'my=value');
res.setHeader('Set-Cookie', [cookie1, cookie2]);
res.writeHead(200);
res.write('Hi there');
res.end();
}).listen(0);
const request = axios.create();
request.interceptors.response.use((res) => {
assert.deepStrictEqual(res.headers['set-cookie'], [
cookie1, cookie2
]);
});
try {
await request({url: `http://localhost:${server.address().port}`});
} finally {
server.close()
}
});
});
});