Problem caching redirect responses
Hi, not sure if I'm using the module as expected, but I wanted to cache a redirect response (res.redirect(URL)), because this redirection is computed from some DB values and it's something I'd like to avoid doing every time.
I'm getting an exception from apicache.js:143 , a..
TypeError: "list" argument must be an Array of Buffers
at Function.Buffer.concat (buffer.js:314:13)
at accumulateContent (.../node_modules/apicache/src/apicache.js:143:40)
This is because the res.end() for the redirect is accumulating a String, and later on the res.write() is triggering a Buffer.concat([oldContent, content], ...) were oldContent is String and content is Buffer (would need to be a concat([Buffer, Buffer]), as it happens with regular res.send() responses).
Is there any workaround for this? Would it make sense to convert contents always to Buffers to avoid running into this issues?
thanks a congrats for the great work!
Not sure but I think there is a problem with nodejs < 8.x version. Not sure but apicache throw this error on my setup only in version 6.x not with nodejs 8.x
Might be fixed with https://github.com/kwhitley/apicache/commit/44c981bf156cee6e4773de042bb65db8dcce35bf available on npm in v1.2.6.