fix: possible HPE_INVALID_CONSTANT in console

Massimo Melina committed Mar 20, 2026 at 14:41 UTC c0f9c3df62d30b4080c2958e254f2889c860bab2
1 file changed +1 -3
src/index.ts
+1 -3
@@ -67,9 +67,7 @@ function errorHandler(err:Error & { code:string, path:string }) {
67 if (code === 'ECANCELED' || code === 'ECONNRESET' || code === 'ECONNABORTED' || code === 'EPIPE'
68 || code === 'ERR_STREAM_WRITE_AFTER_END' // happens disconnecting uploads, don't care
69 || code === 'ERR_STREAM_PREMATURE_CLOSE' // happens when many files are sent (not locally), but I checked that the files are written completely. Introduced after node18.5.0 and is thrown by pipeline() used by PUT method handler.
70 - || code === 'HPE_INVALID_METHOD' // cannot serve you like that
71 - || code === 'HPE_CLOSED_CONNECTION' // uploads with wrong content-length, but we already handle that properly
72 - || code === 'HPE_INVALID_EOF_STATE') return // someone interrupted, don't care
70 + || code.startsWith('HPE')) return // malformed client/probe HTTP parser errors, not internal failures
71 console.error('server error', err)
72 }
73