Blog post proposal: Cancel an upstream response body when an Express 5 client disconnects

Aperta Adatta ai principianti
#2,611 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
express, javascript, node.js
Ambito
documentation

Direzione di ricerca

Inizia leggendo le linee guida per contribuire alla documentazione di Express 5 e individuando la struttura esistente delle guide sulla gestione delle richieste e delle risposte. Prepara il tutorial basandoti sull’esempio proposto con Express 5.3.0 e Node.js 24.12.0, inclusi i suoi tre casi di integrazione loopback. Sarà completo quando l’articolo spiegherà l’annullamento durante la lettura del corpo, la rimozione dei listener e la differenza tra una chiusura anticipata e una risposta completata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Proposed title

Cancel an upstream response body when an Express 5 client disconnects

Outline

A browser closes a media preview while its Express route is still waiting for an upstream response body. The upstream server has sent headers, so the route is already past the first await fetch(). This tutorial would show how to carry the same AbortSignal through body consumption, use the Express response's close event to cancel an unfinished exchange, and remove the listener when the handler exits.

I develop the EasyDown API, which parses public media URLs. The API provides the context for the preview example. The tutorial uses a loopback fixture with synthetic metadata.

The example runs on Express 5.3.0 and Node.js 24.12.0. Three local integration tests passed. They cover a complete response, a client disconnect after the route receives upstream headers, and malformed upstream JSON handled by Express error middleware. The disconnect test waits for the upstream connection to close before its body finishes.

I used Codex to help draft the proposal and build and test the fixture. The article would provide the small route and the runnable tests, with particular attention to the difference between an early connection close and a completed response.

Lingua principale
MDX
Stelle
5.4k
Fork
2.4k
Merge medio
5g 6h
PR unite (30g)
30

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di expressjs/expressjs.com

Tutte le issue di expressjs/expressjs.com

Issue simili

Altre issue su Documentation

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.