Replies: 2 comments
-
|
as long as you're using |
Beta Was this translation helpful? Give feedback.
-
|
puedes eliminar el content-type despues de hacer el send usando res.removeHeader antes, o directamente escribir con res.end() que no toca las cabeceras: // opcion 1: quitar la cabecera antes
res.removeHeader("Content-Type")
res.send(buf)
// opcion 2: usar end() directamente, no infiere content-type
res.end(buf)la diferencia es que res.send() tiene logica para detectar el tipo segun lo que le mandas, pero res.end() es mas bajo nivel y no hace eso. si no necesitas nada de lo que aporta send() quedarte con end() es lo mas simple |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I refactored my app to use in memory buffers instead of files. However an undesired side effect is that for all responses where we do
res.send(buf)without setting an explicitres.type()express now defaults to:I do not want this. Is there a workaround to use
res.send(buffer)without setting any content-type automatically?I know I can explicitly override it with
res.type("bla/bla")but for many resources there is not a known type. In these cases I want to set no content-type response header.I am using express 5.0.1.
Beta Was this translation helpful? Give feedback.
All reactions