-
-
Notifications
You must be signed in to change notification settings - Fork 686
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
interceptors.responseError does not raise networking errors
When the interceptors.responseError interceptor is used, this does not raise network errors, returning the request as if it had been successful.
Reproducible By
import { Pool } from "undici";
const URL = "https://foo.bar.ciao.com"; // <- URL does not exist
async function main() {
const client = new Pool(URL);
try {
const response = await client
.compose(interceptors.responseError({ throwOnError: true }))
.request({ method: "GET", path: "/" });
console.log(response.statusCode);
} catch (e) { // <- not raised
console.log(e);
}
}
if (require.main === module) {
void main();
}Expected Behavior
request raises an error Error: getaddrinfo ENOTFOUND. This is raised when we don't use interceptors.responseError
Environment
- node:
20.18 - undici:
7.1.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working