preactjs / preset-vite

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

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

Closed rschristian closed 9 months ago

rschristian commented 9 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 9 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 9 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.