question: setting dynamic headers
See original GitHub issueHi there,
I have a case where I need to setup headers dynamically, e.g.:
response.setHeader("Expires", dateFormat.format("ddd, DD MMM YYYY HH:mm:ss") + " GMT");
If I do that using response object @Res() response: any
, I always get error:
(node:29688) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:470:11)
at ServerResponse.header (webpack:///./node_modules/express/lib/response.js?:771:10)
at eval (webpack:///./node_modules/routing-controllers/driver/express/ExpressDriver.js?:364:32)
at Array.forEach (<anonymous>)
at ExpressDriver.handleError (webpack:///./node_modules/routing-controllers/driver/express/ExpressDriver.js?:363:45)
at eval (webpack:///./node_modules/routing-controllers/RoutingControllers.js?:104:33)
at process._tickCallback (internal/process/next_tick.js:68:7)
Please advise how to handle this kind of scenario.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Question: Dynamic Headers
HI, My understanding is Boomi is going to release dynamic headers with Rest connector. With dynamic header I mean the header key name...
Read more >Creating Dynamic Column Headers | Tableau Software
Question. How to create dynamic column headers in a dashboard using parameters and calculated fields. Environment. Tableau Desktop. Answer.
Read more >How to create/set dynamic headers in tabulator
You can enable this by setting the autoColumns option to true: var table = new Tabulator("#example-table", { data:tabledata, ...
Read more >How to create/set dynamic headers in tabulator · Issue #2490
Hello, How can we set dynamic header name. is is being passed from JSON. Also I want to know how can we hide...
Read more >Can you dynamically set Headers for integration tests? - Help
My question: Is it possible to dynamically set headers during integration tests? Meaning: request is made multiple times during tests so ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Indeed, I did not. I missed that part in the docs. Thanks a lot!
Did you also disable the
defaultErrorHandler
in theRoutingControllersOptions
?