-
Notifications
You must be signed in to change notification settings - Fork 42
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
feat(fetch): use undici + ProxyAgent
#1000
Conversation
turns out this isn't really necessary at all and tests run way faster without this!
node-fetch
, formdata-node
, msw
ProxyAgent
@@ -135,7 +133,6 @@ describe('rdme openapi', () => { | |||
.basicAuth({ user: key }) | |||
.reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) | |||
.post('/api/v1/api-specification', { registryUUID }) | |||
.delayConnection(1000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love to see it
|
||
server.use( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msw i think you're really neat but my dude... the code bloat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah... once nock started using the same underlying interceptor, it was game over
"gray-matter": "^4.0.1", | ||
"ignore": "^5.2.0", | ||
"mime-types": "^2.1.35", | ||
"node-fetch": "^3.3.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...options, | ||
headers, | ||
dispatcher: proxy ? new ProxyAgent(proxy) : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol @ the way node-fetch forced us to handle proxies 🤡
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol that was not exactly a node-fetch issue and more of a me issue 😭
🧰 Changes
node-fetch
in favor of its native Node.js counterpartformdata-node
in favor of its native Node.js counterpartProxyAgent
for proxying requests1nock
beta in chore(deps):nock@beta
,[email protected]
#999,msw
is no longer required and has been removed.delayConnection
statements so now tests are like 2-3x faster🧬 QA & Testing
Do tests still pass?
Footnotes
We very well might have been doing proxying incorrectly this entire time? Ideally we should use the new
EnvHttpProxyAgent
API instead but that's only supported inundici@6
😔 ↩