diff --git a/README.md b/README.md index e4152a68..1e48c6dc 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Pass `http-cookie-agent` to HTTP clients instead of http(s).Agent. ```js import { CookieJar } from 'tough-cookie'; -import { HttpCookieAgent, HttpsCookieAgent, MixedCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent, MixedCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); @@ -77,7 +77,7 @@ await fetch('https://example.com'); import https from 'node:https'; import { CookieJar } from 'tough-cookie'; -import { HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpsCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); const agent = new HttpsCookieAgent({ jar }); @@ -92,7 +92,7 @@ https.get('https://example.com', { agent }, (res) => { ```js import axios from 'axios'; import { CookieJar } from 'tough-cookie'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); @@ -109,7 +109,7 @@ await client.get('https://example.com'); ```js import fetch from 'node-fetch'; import { CookieJar } from 'tough-cookie'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); @@ -132,7 +132,7 @@ See https://github.com/sindresorhus/got/tree/v11.8.2#cookies. ```js import got from 'got'; import { CookieJar } from 'tough-cookie'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); @@ -155,7 +155,7 @@ See https://github.com/visionmedia/superagent/blob/v6.1.0/docs/index.md#saving-c ```js import superagent from 'superagent'; import { CookieJar } from 'tough-cookie'; -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); const mixedAgent = new MixedCookieAgent({ jar }); @@ -174,7 +174,7 @@ See https://github.com/request/request/tree/v2.88.1#examples. ```js import request from 'request'; import { CookieJar } from 'tough-cookie'; -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); @@ -192,7 +192,7 @@ client.get('https://example.com', (_err, _res) => { ```js import needle from 'needle'; import { CookieJar } from 'tough-cookie'; -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); @@ -206,7 +206,7 @@ await needle('get', 'https://example.com', { ```js import phin from 'phin'; import { CookieJar } from 'tough-cookie'; -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); @@ -223,7 +223,7 @@ await phin({ ```js import Wreck from '@hapi/wreck'; import { CookieJar } from 'tough-cookie'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); @@ -243,7 +243,7 @@ await client.get('https://example.com'); ```js import urllib from 'urllib'; import { CookieJar } from 'tough-cookie'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; const jar = new CookieJar(); @@ -264,7 +264,7 @@ import https from 'node:https'; import { HttpsAgent as KeepAliveAgent } from 'agentkeepalive'; import { CookieJar } from 'tough-cookie'; -import { createCookieAgent } from 'http-cookie-agent'; +import { createCookieAgent } from 'http-cookie-agent/node:http'; const Agent = createCookieAgent(KeepAliveAgent); diff --git a/examples/agentkeepalive/basic.mjs b/examples/agentkeepalive/basic.mjs index 4c56df58..c8c6217f 100644 --- a/examples/agentkeepalive/basic.mjs +++ b/examples/agentkeepalive/basic.mjs @@ -1,7 +1,7 @@ import https from 'node:https'; import { HttpsAgent as KeepAliveAgent } from 'agentkeepalive'; -import { createCookieAgent } from 'http-cookie-agent'; +import { createCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const KeepAliveCookieAgent = createCookieAgent(KeepAliveAgent); diff --git a/examples/axios/basic.mjs b/examples/axios/basic.mjs index 697e9064..0dc8d23f 100644 --- a/examples/axios/basic.mjs +++ b/examples/axios/basic.mjs @@ -1,5 +1,5 @@ import axios from 'axios'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); diff --git a/examples/axios/default.mjs b/examples/axios/default.mjs index 17f3070c..dc11e7e6 100644 --- a/examples/axios/default.mjs +++ b/examples/axios/default.mjs @@ -1,5 +1,5 @@ import axios from 'axios'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); diff --git a/examples/axios/instance.mjs b/examples/axios/instance.mjs index 7986090f..51bc730a 100644 --- a/examples/axios/instance.mjs +++ b/examples/axios/instance.mjs @@ -1,5 +1,5 @@ import axios from 'axios'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); diff --git a/examples/got/basic.mjs b/examples/got/basic.mjs index 7a81a2a1..7cd79029 100644 --- a/examples/got/basic.mjs +++ b/examples/got/basic.mjs @@ -1,5 +1,5 @@ import got from 'got'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); diff --git a/examples/got/instance.mjs b/examples/got/instance.mjs index 92876a08..bf94fab6 100644 --- a/examples/got/instance.mjs +++ b/examples/got/instance.mjs @@ -1,5 +1,5 @@ import got from 'got'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); diff --git a/examples/http-proxy-agent/basic.mjs b/examples/http-proxy-agent/basic.mjs index b766e5e3..35a481b3 100644 --- a/examples/http-proxy-agent/basic.mjs +++ b/examples/http-proxy-agent/basic.mjs @@ -1,6 +1,6 @@ import http from 'node:http'; -import { createCookieAgent } from 'http-cookie-agent'; +import { createCookieAgent } from 'http-cookie-agent/node:http'; import httpProxy from 'http-proxy'; import httpProxyAgent from 'http-proxy-agent'; import { CookieJar } from 'tough-cookie'; diff --git a/examples/needle/basic.mjs b/examples/needle/basic.mjs index d742017d..dcb1e0e5 100644 --- a/examples/needle/basic.mjs +++ b/examples/needle/basic.mjs @@ -1,4 +1,4 @@ -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; import needle from 'needle'; import { CookieJar } from 'tough-cookie'; diff --git a/examples/node-fetch/basic.mjs b/examples/node-fetch/basic.mjs index 67181469..41eb447c 100644 --- a/examples/node-fetch/basic.mjs +++ b/examples/node-fetch/basic.mjs @@ -1,4 +1,4 @@ -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; import fetch from 'node-fetch'; import { CookieJar } from 'tough-cookie'; diff --git a/examples/node/http.mjs b/examples/node/http.mjs index 35def446..83408234 100644 --- a/examples/node/http.mjs +++ b/examples/node/http.mjs @@ -1,6 +1,6 @@ import http from 'node:http'; -import { HttpCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); diff --git a/examples/node/https.mjs b/examples/node/https.mjs index c8224391..892df7f7 100644 --- a/examples/node/https.mjs +++ b/examples/node/https.mjs @@ -1,6 +1,6 @@ import https from 'node:https'; -import { HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpsCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); diff --git a/examples/phin/basic.mjs b/examples/phin/basic.mjs index bc58b710..cc6fb11f 100644 --- a/examples/phin/basic.mjs +++ b/examples/phin/basic.mjs @@ -1,4 +1,4 @@ -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; import phin from 'phin'; import { CookieJar } from 'tough-cookie'; diff --git a/examples/phin/instance.mjs b/examples/phin/instance.mjs index 51d19b95..7286b0a0 100644 --- a/examples/phin/instance.mjs +++ b/examples/phin/instance.mjs @@ -1,4 +1,4 @@ -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; import phin from 'phin'; import { CookieJar } from 'tough-cookie'; diff --git a/examples/request/basic.mjs b/examples/request/basic.mjs index b452638b..e6dc2224 100644 --- a/examples/request/basic.mjs +++ b/examples/request/basic.mjs @@ -1,4 +1,4 @@ -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; import request from 'request'; import { CookieJar } from 'tough-cookie'; diff --git a/examples/request/instance.mjs b/examples/request/instance.mjs index 9c5fa9ba..11c3252c 100644 --- a/examples/request/instance.mjs +++ b/examples/request/instance.mjs @@ -1,4 +1,4 @@ -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; import request from 'request'; import { CookieJar } from 'tough-cookie'; diff --git a/examples/superagent/basic.mjs b/examples/superagent/basic.mjs index 8d6a9aab..94df4f10 100644 --- a/examples/superagent/basic.mjs +++ b/examples/superagent/basic.mjs @@ -1,4 +1,4 @@ -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; import superagent from 'superagent'; import { CookieJar } from 'tough-cookie'; diff --git a/examples/superagent/instance.mjs b/examples/superagent/instance.mjs index 481ae128..28cfe7dd 100644 --- a/examples/superagent/instance.mjs +++ b/examples/superagent/instance.mjs @@ -1,4 +1,4 @@ -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; import superagent from 'superagent'; import { CookieJar } from 'tough-cookie'; diff --git a/examples/urllib/basic.mjs b/examples/urllib/basic.mjs index e87d84ac..bdc38657 100644 --- a/examples/urllib/basic.mjs +++ b/examples/urllib/basic.mjs @@ -1,4 +1,4 @@ -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; import urllib from 'urllib'; diff --git a/examples/urllib/instance.mjs b/examples/urllib/instance.mjs index 73beb8e8..c2ed772a 100644 --- a/examples/urllib/instance.mjs +++ b/examples/urllib/instance.mjs @@ -1,4 +1,4 @@ -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; import urllib from 'urllib'; diff --git a/examples/wreck/basic.mjs b/examples/wreck/basic.mjs index 0bc6a703..7cd69c34 100644 --- a/examples/wreck/basic.mjs +++ b/examples/wreck/basic.mjs @@ -1,5 +1,5 @@ import Wreck from '@hapi/wreck'; -import { MixedCookieAgent } from 'http-cookie-agent'; +import { MixedCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); diff --git a/examples/wreck/default.mjs b/examples/wreck/default.mjs index adf207f3..3ff6c4ee 100644 --- a/examples/wreck/default.mjs +++ b/examples/wreck/default.mjs @@ -1,5 +1,5 @@ import Wreck from '@hapi/wreck'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); diff --git a/examples/wreck/instance.mjs b/examples/wreck/instance.mjs index 2e9c2dc1..99ae89b5 100644 --- a/examples/wreck/instance.mjs +++ b/examples/wreck/instance.mjs @@ -1,5 +1,5 @@ import Wreck from '@hapi/wreck'; -import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent'; +import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); diff --git a/index.d.ts b/node:http/index.d.ts similarity index 93% rename from index.d.ts rename to node:http/index.d.ts index 927df4a1..5fcd1f52 100644 --- a/index.d.ts +++ b/node:http/index.d.ts @@ -1,5 +1,5 @@ -import * as http from 'node:http'; -import * as https from 'node:https'; +import http from 'node:http'; +import https from 'node:https'; import { CookieJar } from 'tough-cookie'; diff --git a/node:http/index.js b/node:http/index.js new file mode 100644 index 00000000..b548d7f5 --- /dev/null +++ b/node:http/index.js @@ -0,0 +1 @@ +module.exports = require('../dist/node:http'); diff --git a/package.json b/package.json index df0664dd..586d7977 100644 --- a/package.json +++ b/package.json @@ -30,15 +30,13 @@ "license": "MIT", "author": "3846masa <3846masahiro+git@gmail.com>", "exports": { - ".": "./dist/index.js", + "./node:http": "./node:http/index.js", "./undici": "./undici/index.js" }, - "main": "dist/index.js", - "types": "index.d.ts", "files": [ "dist", "undici", - "index.d.ts", + "node:http", "!**/__tests__" ], "scripts": { diff --git a/src/__tests__/agentkeepalive.spec.mts b/src/node:http/__tests__/agentkeepalive.spec.mts similarity index 98% rename from src/__tests__/agentkeepalive.spec.mts rename to src/node:http/__tests__/agentkeepalive.spec.mts index ae628951..8b5601b1 100644 --- a/src/__tests__/agentkeepalive.spec.mts +++ b/src/node:http/__tests__/agentkeepalive.spec.mts @@ -4,10 +4,9 @@ import KeepAliveAgent from 'agentkeepalive'; import test from 'ava'; import { CookieJar } from 'tough-cookie'; +import { createTestServer } from '../../__tests__/helpers.mjs'; import { createCookieAgent } from '../index.js'; -import { createTestServer } from './helpers.mjs'; - const KeepAliveCookieAgent = createCookieAgent(KeepAliveAgent); export function request(url: string, options: http.RequestOptions) { diff --git a/src/__tests__/axios.spec.mts b/src/node:http/__tests__/axios.spec.mts similarity index 98% rename from src/__tests__/axios.spec.mts rename to src/node:http/__tests__/axios.spec.mts index 765f3a20..a46eb9d7 100644 --- a/src/__tests__/axios.spec.mts +++ b/src/node:http/__tests__/axios.spec.mts @@ -2,10 +2,9 @@ import test from 'ava'; import axios from 'axios'; import { CookieJar } from 'tough-cookie'; +import { createTestServer, readStream } from '../../__tests__/helpers.mjs'; import { HttpCookieAgent } from '../index.js'; -import { createTestServer, readStream } from './helpers.mjs'; - test('should set cookies to CookieJar from Set-Cookie header', async (t) => { const jar = new CookieJar(); const agent = new HttpCookieAgent({ jar }); diff --git a/src/__tests__/got.spec.mts b/src/node:http/__tests__/got.spec.mts similarity index 98% rename from src/__tests__/got.spec.mts rename to src/node:http/__tests__/got.spec.mts index c76a34e2..86a23bbc 100644 --- a/src/__tests__/got.spec.mts +++ b/src/node:http/__tests__/got.spec.mts @@ -2,10 +2,9 @@ import test from 'ava'; import got from 'got'; import { CookieJar } from 'tough-cookie'; +import { createTestServer, readStream } from '../../__tests__/helpers.mjs'; import { HttpCookieAgent } from '../index.js'; -import { createTestServer, readStream } from './helpers.mjs'; - test('should set cookies to CookieJar from Set-Cookie header', async (t) => { const jar = new CookieJar(); const agent = new HttpCookieAgent({ jar }); diff --git a/src/__tests__/http-proxy-agent.spec.mts b/src/node:http/__tests__/http-proxy-agent.spec.mts similarity index 98% rename from src/__tests__/http-proxy-agent.spec.mts rename to src/node:http/__tests__/http-proxy-agent.spec.mts index 7add49cf..01339bb3 100644 --- a/src/__tests__/http-proxy-agent.spec.mts +++ b/src/node:http/__tests__/http-proxy-agent.spec.mts @@ -4,10 +4,9 @@ import test from 'ava'; import hpa from 'http-proxy-agent'; import { CookieJar } from 'tough-cookie'; +import { createTestServerWithProxy } from '../../__tests__/helpers.mjs'; import { createCookieAgent } from '../create_cookie_agent.js'; -import { createTestServerWithProxy } from './helpers.mjs'; - const HttpProxyCookieAgent = createCookieAgent(hpa.HttpProxyAgent); export function request(url: string, options: http.RequestOptions) { diff --git a/src/__tests__/http.spec.mts b/src/node:http/__tests__/http.spec.mts similarity index 98% rename from src/__tests__/http.spec.mts rename to src/node:http/__tests__/http.spec.mts index 7e03c982..4e890d63 100644 --- a/src/__tests__/http.spec.mts +++ b/src/node:http/__tests__/http.spec.mts @@ -3,10 +3,9 @@ import http from 'node:http'; import test from 'ava'; import { CookieJar } from 'tough-cookie'; +import { createTestServer, readStream } from '../../__tests__/helpers.mjs'; import { HttpCookieAgent } from '../index.js'; -import { createTestServer, readStream } from './helpers.mjs'; - export function request(url: string, options: http.RequestOptions) { const req = http.request(url, options); diff --git a/src/__tests__/mixed_cookie_agent.spec.mts b/src/node:http/__tests__/mixed_cookie_agent.spec.mts similarity index 98% rename from src/__tests__/mixed_cookie_agent.spec.mts rename to src/node:http/__tests__/mixed_cookie_agent.spec.mts index c90bbcfd..f6697862 100644 --- a/src/__tests__/mixed_cookie_agent.spec.mts +++ b/src/node:http/__tests__/mixed_cookie_agent.spec.mts @@ -3,10 +3,9 @@ import http from 'node:http'; import test from 'ava'; import { CookieJar } from 'tough-cookie'; +import { createTestServer } from '../../__tests__/helpers.mjs'; import { MixedCookieAgent } from '../index.js'; -import { createTestServer } from './helpers.mjs'; - export function request(url: string, options: http.RequestOptions) { const req = http.request(url, options); diff --git a/src/__tests__/needle.spec.mts b/src/node:http/__tests__/needle.spec.mts similarity index 98% rename from src/__tests__/needle.spec.mts rename to src/node:http/__tests__/needle.spec.mts index 440b700b..caedb8b6 100644 --- a/src/__tests__/needle.spec.mts +++ b/src/node:http/__tests__/needle.spec.mts @@ -2,10 +2,9 @@ import test from 'ava'; import needle from 'needle'; import { CookieJar } from 'tough-cookie'; +import { createTestServer, readStream } from '../../__tests__/helpers.mjs'; import { HttpCookieAgent } from '../index.js'; -import { createTestServer, readStream } from './helpers.mjs'; - test('should set cookies to CookieJar from Set-Cookie header', async (t) => { const jar = new CookieJar(); const agent = new HttpCookieAgent({ jar }); diff --git a/src/__tests__/node-fetch.spec.mts b/src/node:http/__tests__/node-fetch.spec.mts similarity index 98% rename from src/__tests__/node-fetch.spec.mts rename to src/node:http/__tests__/node-fetch.spec.mts index 35d5a14d..6c2dda78 100644 --- a/src/__tests__/node-fetch.spec.mts +++ b/src/node:http/__tests__/node-fetch.spec.mts @@ -2,10 +2,9 @@ import test from 'ava'; import fetch from 'node-fetch'; import { CookieJar } from 'tough-cookie'; +import { createTestServer, readStream } from '../../__tests__/helpers.mjs'; import { HttpCookieAgent } from '../index.js'; -import { createTestServer, readStream } from './helpers.mjs'; - test('should set cookies to CookieJar from Set-Cookie header', async (t) => { const jar = new CookieJar(); const agent = new HttpCookieAgent({ jar }); diff --git a/src/__tests__/phin.spec.mts b/src/node:http/__tests__/phin.spec.mts similarity index 98% rename from src/__tests__/phin.spec.mts rename to src/node:http/__tests__/phin.spec.mts index 90e08acd..56a0957b 100644 --- a/src/__tests__/phin.spec.mts +++ b/src/node:http/__tests__/phin.spec.mts @@ -2,10 +2,9 @@ import test from 'ava'; import phin from 'phin'; import { CookieJar } from 'tough-cookie'; +import { createTestServer, readStream } from '../../__tests__/helpers.mjs'; import { HttpCookieAgent } from '../index.js'; -import { createTestServer, readStream } from './helpers.mjs'; - test('should set cookies to CookieJar from Set-Cookie header', async (t) => { const jar = new CookieJar(); const agent = new HttpCookieAgent({ jar }); diff --git a/src/__tests__/request.spec.mts b/src/node:http/__tests__/request.spec.mts similarity index 98% rename from src/__tests__/request.spec.mts rename to src/node:http/__tests__/request.spec.mts index 7ec82873..fbb55e87 100644 --- a/src/__tests__/request.spec.mts +++ b/src/node:http/__tests__/request.spec.mts @@ -4,10 +4,9 @@ import test from 'ava'; import request from 'request'; import { CookieJar } from 'tough-cookie'; +import { createTestServer, readStream } from '../../__tests__/helpers.mjs'; import { HttpCookieAgent } from '../index.js'; -import { createTestServer, readStream } from './helpers.mjs'; - test('should set cookies to CookieJar from Set-Cookie header', async (t) => { const jar = new CookieJar(); const agent = new HttpCookieAgent({ jar }); diff --git a/src/__tests__/superagent.spec.mts b/src/node:http/__tests__/superagent.spec.mts similarity index 98% rename from src/__tests__/superagent.spec.mts rename to src/node:http/__tests__/superagent.spec.mts index f89e2cb4..3ee7e2db 100644 --- a/src/__tests__/superagent.spec.mts +++ b/src/node:http/__tests__/superagent.spec.mts @@ -2,10 +2,9 @@ import test from 'ava'; import superagent from 'superagent'; import { CookieJar } from 'tough-cookie'; +import { createTestServer, readStream } from '../../__tests__/helpers.mjs'; import { HttpCookieAgent } from '../index.js'; -import { createTestServer, readStream } from './helpers.mjs'; - test('should set cookies to CookieJar from Set-Cookie header', async (t) => { const jar = new CookieJar(); const agent = new HttpCookieAgent({ jar }); diff --git a/src/__tests__/urllib.spec.mts b/src/node:http/__tests__/urllib.spec.mts similarity index 98% rename from src/__tests__/urllib.spec.mts rename to src/node:http/__tests__/urllib.spec.mts index f7fafbb9..6a9ef280 100644 --- a/src/__tests__/urllib.spec.mts +++ b/src/node:http/__tests__/urllib.spec.mts @@ -2,10 +2,9 @@ import test from 'ava'; import { CookieJar } from 'tough-cookie'; import urllib from 'urllib'; +import { createTestServer, readStream } from '../../__tests__/helpers.mjs'; import { HttpCookieAgent } from '../index.js'; -import { createTestServer, readStream } from './helpers.mjs'; - test('should set cookies to CookieJar from Set-Cookie header', async (t) => { const jar = new CookieJar(); const agent = new HttpCookieAgent({ jar }); diff --git a/src/__tests__/wreck.spec.mts b/src/node:http/__tests__/wreck.spec.mts similarity index 98% rename from src/__tests__/wreck.spec.mts rename to src/node:http/__tests__/wreck.spec.mts index 340296e0..82c58f68 100644 --- a/src/__tests__/wreck.spec.mts +++ b/src/node:http/__tests__/wreck.spec.mts @@ -2,10 +2,9 @@ import Wreck from '@hapi/wreck'; import test from 'ava'; import { CookieJar } from 'tough-cookie'; +import { createTestServer, readStream } from '../../__tests__/helpers.mjs'; import { HttpCookieAgent } from '../index.js'; -import { createTestServer, readStream } from './helpers.mjs'; - test('should set cookies to CookieJar from Set-Cookie header', async (t) => { const jar = new CookieJar(); const agent = new HttpCookieAgent({ jar }); diff --git a/src/create_cookie_agent.ts b/src/node:http/create_cookie_agent.ts similarity index 100% rename from src/create_cookie_agent.ts rename to src/node:http/create_cookie_agent.ts diff --git a/src/http_cookie_agent.ts b/src/node:http/http_cookie_agent.ts similarity index 100% rename from src/http_cookie_agent.ts rename to src/node:http/http_cookie_agent.ts diff --git a/src/https_cookie_agent.ts b/src/node:http/https_cookie_agent.ts similarity index 100% rename from src/https_cookie_agent.ts rename to src/node:http/https_cookie_agent.ts diff --git a/src/index.ts b/src/node:http/index.ts similarity index 100% rename from src/index.ts rename to src/node:http/index.ts diff --git a/src/mixed_cookie_agent.ts b/src/node:http/mixed_cookie_agent.ts similarity index 100% rename from src/mixed_cookie_agent.ts rename to src/node:http/mixed_cookie_agent.ts