preactjs / preset-vite

Preset for using Preact with the vite bundler
https://npm.im/@preact/preset-vite
MIT License
260 stars 26 forks source link

Possibly flesh out prerender `fetch` patch with `ok`, `status`, etc. #103

Closed rschristian closed 8 months ago

rschristian commented 8 months ago

Just ran into this on www, we check response.ok but the patched fetch here only provides { text, json} in the response.

There are of course workarounds, and we probably can't / wouldn't want to mock out everything, but it might be worth considering the following:

Tbf, only really going to be an issue seen in existing projects.

marvinhagemeister commented 8 months ago

FYI: These days there is the Response constructor, so we should be able to do new Response(content, init) which has all the properties. So instead of stubbing a response we could construct a real one ourselves.

rschristian commented 8 months ago

Yup, that's what I was thinking with the second option, which I only though of after I wrote the "probably can't / wouldn't want to" remark.

I should reread what I write before posting.