Repository navigation
Immutable
release. Only release title and notes can be modified.
Upgrading from 4.x
- Node.js and modules. Use Node.js 22.19.0 or later. urllib now ships a single ES module. Use
import { request } from 'urllib'in ESM orawait import('urllib')inside an async CommonJS function. #722 · #904 · #820 - HTTP/2 by default. With undici 8, HTTPS requests negotiate HTTP/2 when the server supports it. To force HTTP/1.1, pass
{ allowH2: false }torequest()orHttpClient. If you supply an undiciPoolorClientas the dispatcher, set the option when you construct it. #820 - Timeout handling. If you inspect
err.cause.codefor HTTP/2 response-header timeouts, update your check fromUND_ERR_INFOtoUND_ERR_HEADERS_TIMEOUT. #820 - TypeScript. The declarations now use
type-fest6, which requires TypeScript 6 or later withstrictenabled.RequestOptions.signalnow acceptsAbortSignal | EventEmitter. #995 · #820
Redirects and query strings
- When urllib follows a
303 See Other, it changes any method other thanGETorHEADtoGETand drops the body and content headers. If the target needs a retry, urllib retries only the target. A failed redirect after aPOSTupload no longer resends the upload. #1000 - For
GETandHEAD, urllib appends requestdatato the query string before the URL fragment. For example, adding{ page: 2 }to/search?q=node#topsends/search?q=node&page=2to the server. #1000
API and diagnostics
- Import
getCookies,getSetCookies,setCookie,deleteCookie,parseCookie, and theCookietype directly fromurllib. #742 res.timing.dnslookupreports milliseconds from the start of the request until DNS lookup completes. It is0on a reused socket.getDispatcherPoolStats()combines HTTP/1.1 and HTTP/2 counters for each origin. #743 · #820- The exported
RequestOptionstype now includesrejectUnauthorizedfor top-levelrequest()andcurl(). For anHttpClientinstance, configureconnect.rejectUnauthorized. #919
Security fixes also available in 4.x. Version 4.9.1 stopped forwarding credentials on cross-origin redirects. Version 4.9.2 added escaping for multipart filenames and field names. Both fixes are included in 5.0.0. v4.9.1 · v4.9.2
First-time contributor. @dependabot[bot] contributed #631.