You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that atm we take over response handling (by returning h.abandon) which also means headers handling.
Doing cors handling ourselves would be a bit much, it would be nicer if we could just let hapi do that.
The proposed solution is to properly return/handle the transform streams we use back to hapi and then continue the lifecycle by returning h.continue.
For csv (works):
Set csvStream._readableState.objectMode = false; and don't pipe res
Quoting @kanongil (who helped a lot with these initial findings 🙏)
It works because the implementation doesn't actually use objectMode for the output, and this is a way to change the mode for only that end
The problem is that atm we take over response handling (by returning
h.abandon
) which also means headers handling.Doing cors handling ourselves would be a bit much, it would be nicer if we could just let hapi do that.
The proposed solution is to properly return/handle the transform streams we use back to hapi and then continue the lifecycle by returning
h.continue
.For csv (works):
csvStream._readableState.objectMode = false;
and don't piperes
fast-csv
to actually fix this [BUG] readable stream part of CsvFormatterStream is in objectMode C2FO/fast-csv#319headers
property of thecsvStream
so that hapi will pick them upcsvStream
For Excel (not tested):
WorkbookWriter
that has its readable side not in object modeheaders
property of the duplex stream so that hapi will pick them upThere is branch with tests and a working csv version here: https://github.com/Salesflare/hapi-csv/tree/cors-and-lifecycle-fix
The text was updated successfully, but these errors were encountered: