diff options
author | Luca Casonato <hello@lcas.dev> | 2022-08-24 14:10:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-24 17:40:57 +0530 |
commit | f3bde1d53b4710fb526286e27af29a55f5da18c7 (patch) | |
tree | e9ff07886e5cc7ac0535ece0c47fe2447b509e4d /cli/bench/testdata | |
parent | 452df99222911c772657c39491469bd97935f23a (diff) |
feat(ext/flash): split upgradeHttp into two APIs (#15557)
This commit splits `Deno.upgradeHttp` into two different APIs, because
the same API is currently overloaded with two different functions. Flash
requests upgrade immediately, with no need to return a `Response`
object. Instead you have to manually write the response to the socket.
Hyper requests only upgrade once a `Response` object has been sent.
These two behaviours are now split into `Deno.upgradeHttp` and
`Deno.upgradeHttpRaw`. The latter is flash only. The former only
supports hyper requests at the moment, but can be updated to support
flash in the future.
Additionally this removes `void | Promise<void>` as valid return types
for the handler function. If one wants to use `Deno.upgradeHttpRaw`,
they will have to type cast the handler signature - the signature is
meant for the 99.99%, and should not be complicated for the 0.01% that
use `Deno.upgradeHttpRaw()`.
Diffstat (limited to 'cli/bench/testdata')
-rw-r--r-- | cli/bench/testdata/deno_upgrade_http.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/bench/testdata/deno_upgrade_http.js b/cli/bench/testdata/deno_upgrade_http.js index 7274459c9..db14f8589 100644 --- a/cli/bench/testdata/deno_upgrade_http.js +++ b/cli/bench/testdata/deno_upgrade_http.js @@ -1,8 +1,8 @@ -const { serve, upgradeHttp } = Deno; +const { serve, upgradeHttpRaw } = Deno; const u8 = Deno.core.encode("HTTP/1.1 101 Switching Protocols\r\n\r\n"); async function handler(req) { - const [conn, _firstPacket] = upgradeHttp(req); + const [conn, _firstPacket] = upgradeHttpRaw(req); await conn.write(u8); await conn.close(); } |