unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.89k stars 496 forks source link

fix(aws-lambda-streaming): handle additional XMLHttpRequestBodyInit types #2616

Open Jhinger opened 2 months ago

Jhinger commented 2 months ago

Open to feedback as I'm sure this isn't the most elegant way to handle this, however it did resolve the issue I was experiencing in the linked issue.

๐Ÿ”— Linked issue

2613

โ“ Type of change

๐Ÿ“š Description

I would get the error reader.getReader is not a function whenever I tried to redirect from a SolidStart api route - the request body returned by nitroApp.localCall can be of type ReadableStream or XMLHttpRequestBodyInit, the latter was not being handled which was causing the error.

๐Ÿ“ Checklist

shunjilin commented 1 month ago

Just to add, my team was in the process of upgrading our regular APIs to the stream-based API for certain routes that needed to support streams, and this fix works with the regular routes as well