corycook / express-delayed-response Goto Github PK
View Code? Open in Web Editor NEWBreak long running processes into multiple requests with a status end point.
License: Apache License 2.0
Break long running processes into multiple requests with a status end point.
License: Apache License 2.0
Getting an error seemingly randomly:
_http_outgoing.js:371
throw new Error('Can\'t set headers after they are sent.');
^
Error: Can't set headers after they are sent.
at ServerResponse.setHeader (_http_outgoing.js:371:11)
at ServerResponse.header (/Users/corycook/Documents/genesis/genesis-ui-api/node_modules/express/lib/response.js:719:10)
at ServerResponse.response.(anonymous function).args [as set] (/Users/corycook/Documents/genesis/genesis-ui-api/node_modules/express-delayed-response/index.js:48:39)
at ServerResponse.json (/Users/corycook/Documents/genesis/genesis-ui-api/node_modules/express/lib/response.js:247:10)
at ServerResponse.response.(anonymous function).args [as json] (/Users/corycook/Documents/genesis/genesis-ui-api/node_modules/express-delayed-response/index.js:48:39)
at Timeout.setTimeout [as _onTimeout] (/Users/corycook/Documents/genesis/genesis-ui-api/node_modules/express-delayed-response/index.js:71:34)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
There is a condition that can cause the timeout to occur as the original response is sending. It should check to see if the headers have been sent before attempting to send the 202 response.
As mentioned in doc I tried to use
app.get('/status/:id', status());
but it gave me 404 error
I change the above line to
app.use('/status/:id', status());
then it worked.
is this something wrong with my code or doc needs to be updated ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.