closes#2346
The primary issue was the snippet `headers[key] = value`. This caused
only one `set-cookie` to make it through. Switching to a `Headers`
object allowed me to use `append` when appropriate, allowing for
multiple `set-cookie` entries.
I also cleaned up one of the tests to make use of steps, because I
originally broke it and couldn't immediately tell which part was
failing.
As outlined in https://github.com/denoland/fresh/issues/2254 it was
possible to overwrite the script tag that is used by Fresh to pass
island props from the server to the client. This could be done by
injecting raw HTML via `dangerouslySetInnerHTML` and simply using the
same id that Fresh was using.
With this PR we generate a unique id per render that cannot be guessed
anymore. It's composed of `__FRSH_STATE_<uuid>`
Using `createHandler()` is simpler than starting a server and fetching a
page. `createHandler()` avoids unnecessary network requests, which can
be flaky when you only need to analyse parts of the returned request. I
think we should push for more use of `createHandler()` and only start a
server as a last resort.
This closes#1896, or rather the particular test mentioned there, but
other tests involving TCP connections can still occur. Again, their
remedy is to use `createHandler()` instead of starting a server.