-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(adapter-node-http): Upgrade nock to v11.x (#273)
- Loading branch information
1 parent
ee25c77
commit 5d42cbd
Showing
12 changed files
with
102 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import createNodeConfig from '../../../scripts/rollup/node.config'; | ||
|
||
export default createNodeConfig({ | ||
external: ['http', 'https', 'url', 'stream'] | ||
}); | ||
import { external } from './rollup.config.shared'; | ||
|
||
export default createNodeConfig({ external }); |
10 changes: 10 additions & 0 deletions
10
packages/@pollyjs/adapter-node-http/rollup.config.shared.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const external = [ | ||
'http', | ||
'https', | ||
'url', | ||
'stream', | ||
'timers', | ||
'tty', | ||
'util', | ||
'os' | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import createNodeTestConfig from '../../../scripts/rollup/node.test.config'; | ||
import createJestTestConfig from '../../../scripts/rollup/jest.test.config'; | ||
|
||
const external = ['http', 'https', 'url', 'stream', 'crypto']; | ||
import { external } from './rollup.config.shared'; | ||
|
||
const testExternal = [...external, 'crypto']; | ||
|
||
export default [ | ||
createNodeTestConfig({ external }), | ||
createJestTestConfig({ external }) | ||
createNodeTestConfig({ external: testExternal }), | ||
createJestTestConfig({ external: testExternal }) | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
packages/@pollyjs/adapter-node-http/src/utils/is-binary-buffer.js
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
packages/@pollyjs/adapter-node-http/src/utils/is-content-encoded.js
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
packages/@pollyjs/adapter-node-http/src/utils/parse-request-arguments.js
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
packages/@pollyjs/adapter-node-http/src/utils/url-to-options.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Utility function that converts a URL object into an ordinary | ||
* options object as expected by the http.request and https.request APIs. | ||
* | ||
* This was copied from Node's source | ||
* https://github.com/nodejs/node/blob/908292cf1f551c614a733d858528ffb13fb3a524/lib/internal/url.js#L1257 | ||
*/ | ||
export default function urlToOptions(url) { | ||
const options = { | ||
protocol: url.protocol, | ||
hostname: | ||
typeof url.hostname === 'string' && url.hostname.startsWith('[') | ||
? url.hostname.slice(1, -1) | ||
: url.hostname, | ||
hash: url.hash, | ||
search: url.search, | ||
pathname: url.pathname, | ||
path: `${url.pathname}${url.search || ''}`, | ||
href: url.href | ||
}; | ||
|
||
if (url.port !== '') { | ||
options.port = Number(url.port); | ||
} | ||
|
||
if (url.username || url.password) { | ||
options.auth = `${url.username}:${url.password}`; | ||
} | ||
|
||
return options; | ||
} |
20 changes: 0 additions & 20 deletions
20
packages/@pollyjs/adapter-node-http/tests/unit/utils/is-binary-buffer-test.js
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
packages/@pollyjs/adapter-node-http/tests/unit/utils/is-content-encoded-test.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.