Introducing Undici@4

Why Undici

Notable Changes

WASM Parser

Redirect Support

Native Mock

import { request, MockAgent, setGlobalDispatcher } from './index.js'const agent = new MockAgent()agent.disableNetConnect()
agent.get('http://localhost:3000')
.intercept({
path: '/foo',
method: 'GET'
})
.reply(200, 'hello world')
setGlobalDispatcher(agent)const {
statusCode,
headers,
trailers,
body
} = await request('http://localhost:3000/foo')
console.log('response received', statusCode)
console.log('headers', headers)
body.setEncoding('utf8')
for await (const data of body) {
console.log('data', data)
}
console.log('trailers', trailers)

Website and Documentation

Dispatcher instead of Agent

Support Node v12.x

What’s next?

Benchmarks

Thanks

Node.js is a collaborative open source project dedicated to building and supporting the Node.js platform. https://nodejs.org/en/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Tutorial — How to insert WebSpeech API in your project!

Background Location Tracking in React Native

Let's create an interactive popover in angular 5+ from scratch!

Our vision and technology

Momma Taught Me To Always Keep My Promises

Angular Tutorial 4 — New Components and Routing

Build Out API Requests in Javascript

Securing a React Web App With Authorization Rules

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Node.js

Node.js

Node.js is a collaborative open source project dedicated to building and supporting the Node.js platform. https://nodejs.org/en/

More from Medium

Creating A Deno/Node.js package

The Node.js logo with the Deno mascot on either side, looking at Node.js

Running a NodeJS app with Postgres in Dokku

Selecting A Node.js Image for Docker

Writing Unit Tests for Your Node.js API