summaryrefslogtreecommitdiff
path: root/tests/unit/serve_test.ts
AgeCommit message (Collapse)Author
2024-11-08feat(ext/http): abort event when request is cancelled (#26781)Divy Srivastava
```js Deno.serve(async (req) => { const { promise, resolve } = Promise.withResolvers<void>(); req.signal.addEventListener("abort", () => { resolve(); }); await promise; return new Response("Ok"); }); ```
2024-11-07feat(ext/http): abort signal when request is cancelled (#26761)Divy Srivastava
Closes https://github.com/denoland/deno/issues/21653
2024-09-18refactor(ext): align error messages (#25496)Ian Bull
Aligns the error messages in the ext/http and a few messages in the ext/fetch folder to be in-line with the Deno style guide. This change-set also removes some unnecessary checks in the 00_serve.ts. These options were recently removed, so it doesn't make sense to check for them anymore. https://github.com/denoland/deno/issues/25269
2024-09-18fix(ext/http): gracefully handle Response.error responses (#25712)Luca Casonato
Fixes #14371
2024-09-14feat: print `Listening on` messages on stderr instead of stdout (#25491)Marvin Hagemeister
Fixes https://github.com/denoland/deno/issues/25114 --------- Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: crowlkats <crowlkats@toaxl.com> Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
2024-09-12test: remove `DENO_FUTURE` (#25587)Asher Gomez
2024-09-10BREAKING(io): remove `Deno.{Reader,Writer}[Sync]` and `Deno.Closer` (#25524)Asher Gomez
2024-09-06fix: invalid ipv6 hostname on `deno serve` (#25482)Marvin Hagemeister
This PR fixes an invalid URL being printed when running `deno serve` Before: invalid URL ```sh $ deno serve --host localhost deno serve: Listening on http://::1:8000/ ``` After: valid URL ```sh $ deno serve --host localhost deno serve: Listening on http://[::1]:8000/ ```
2024-09-05fix(ext/http): do not set localhost to hostname unnecessarily (#24777)Yoshiya Hinosawa
This commit changes when to cause the hostname substition of `0.0.0.0` -> `localhost`. Currently we substitute `localhost` to the hostname on windows before calling `options.onListen`, which prevents the users to do more advanced thing using hostname string like https://github.com/denoland/std/issues/5558. This PR changes it not to substitute it when the user provide `onListen` callback. closes #24776 unblocks https://github.com/denoland/std/issues/5558
2024-08-26Reland "test: run unit tests with DENO_FUTURE=1" (#25212)Bartek Iwańczuk
Reverted in https://github.com/denoland/deno/pull/25060
2024-08-20fix(ext/net): validate port in Deno.{connect,serve,listen} (#24399)seb
Co-authored-by: Will Leach <4619280+melbourne2991@users.noreply.github.com> Co-authored-by: Luca Casonato <hello@lcas.dev> Co-authored-by: David Sherret <dsherret@gmail.com>
2024-08-20chore: enable no-console dlint rule (#25113)David Sherret
2024-08-01fix(ext/http): correctly consume response body in `Deno.serve` (#24811)Luca Casonato
Prior to this commit, you could return a `Response` created from a string or Uint8Array multiple times. Now you can't do that anymore.
2024-07-28fix(http): Adjust hostname display for Windows when using 0.0.0.0 (#24698)Yazan AbdAl-Rahman
Fixes #24687 --------- Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-07-25chore: update to `std@2024.07.19` (#24715)Asher Gomez
2024-07-18Reland "refactor(fetch): reimplement fetch with hyper instead of reqwest" ↵Bartek Iwańczuk
(#24593) Originally landed in https://github.com/denoland/deno/commit/f6fd6619e708a515831f707438368d81b0c9aa56. Reverted in https://github.com/denoland/deno/pull/24574. This reland contains a fix that sends "Accept: */*" header for calls made from "FileFetcher". Absence of this header made downloading source code from JSR broken. This is tested by ensuring this header is present in the test server that servers JSR packages. --------- Co-authored-by: Sean McArthur <sean@seanmonstar.com>
2024-07-13Revert "refactor(fetch): reimplement fetch with hyper instead of reqwest ↵Ryan Dahl
(#24237)" (#24574) This reverts commit f6fd6619e708a515831f707438368d81b0c9aa56. I'm seeing a difference between canary and 1.45.2. In `deno-docs/reference_gen` I can't download dax when running `deno task types` ``` ~/src/deno-docs/reference_gen# deno upgrade --canary Looking up latest canary version Found latest version f6fd6619e708a515831f707438368d81b0c9aa56 Downloading https://dl.deno.land/canary/f6fd6619e708a515831f707438368d81b0c9aa56/deno-aarch64-apple-darwin.zip Deno is upgrading to version f6fd6619e708a515831f707438368d81b0c9aa56 Archive: /var/folders/9v/kys6gqns6kl8nksyn4l1f9v40000gn/T/.tmpb5lDnq/deno.zip inflating: deno Upgraded successfully ~/src/deno-docs/reference_gen# deno -v deno 1.45.2+f6fd661 ~/src/deno-docs/reference_gen# rm -rf /Users/ry/Library/Caches/deno ~/src/deno-docs/reference_gen# deno task types Task types deno task types:deno && deno task types:node Task types:deno deno run --allow-read --allow-write --allow-run --allow-env --allow-sys deno-docs.ts error: JSR package manifest for '@david/dax' failed to load. expected value at line 1 column 1 at file:///Users/ry/src/deno-docs/reference_gen/deno-docs.ts:2:15 ~/src/deno-docs/reference_gen# deno upgrade --version 1.45.2 Downloading https://github.com/denoland/deno/releases/download/v1.45.2/deno-aarch64-apple-darwin.zip Deno is upgrading to version 1.45.2 Archive: /var/folders/9v/kys6gqns6kl8nksyn4l1f9v40000gn/T/.tmp3R7uhF/deno.zip inflating: deno Upgraded successfully ~/src/deno-docs/reference_gen# rm -rf /Users/ry/Library/Caches/deno ~/src/deno-docs/reference_gen# deno task types Task types deno task types:deno && deno task types:node Task types:deno deno run --allow-read --allow-write --allow-run --allow-env --allow-sys deno-docs.ts Task types:node deno run --allow-read --allow-write=. --allow-env --allow-sys node-docs.ts ```
2024-07-13refactor(fetch): reimplement fetch with hyper instead of reqwest (#24237)Sean McArthur
This commit re-implements `ext/fetch` and all dependent crates using `hyper` and `hyper-util`, instead of `reqwest`. The reasoning is that we want to have greater control and access to low level `hyper` APIs when implementing `fetch` API as well as `node:http` module. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-09fix(net): handle panic on Windows for Unix socket usage in Deno.serve() ↵Yazan AbdAl-Rahman
(#24423) This PR addresses the issue where Deno.serve() panics on Windows when trying to use a Unix socket. Fixes #21967
2024-07-02chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24388)Bartek Iwańczuk
Reland of https://github.com/denoland/deno/pull/24056 that doesn't suffer from the problem that was discovered in https://github.com/denoland/deno/pull/24261. It uses upgraded `hyper` and `hyper-util` that fixed the previous problem in https://github.com/hyperium/hyper/pull/3691.
2024-06-19Revert "chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24056)" (#24262)Bartek Iwańczuk
This reverts commit fb31eaa9ca59f6daaee0210d5cd206185c7041b9. Reverting because users reported spurious errors when downloading dependencies - https://github.com/denoland/deno/issues/24260. Closes https://github.com/denoland/deno/issues/24260
2024-06-13chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24056)Bartek Iwańczuk
This commit updates Deno to use `reqwest` at 0.12.4 and `rustls` at 0.22. Other related crates were updated as well to match versions accepted by `reqwest` and `rustls`. Note: we are not using the latest available `rustls` yet, but this upgrade was non-trivial already, so a bump to 0.23 for `rustls` will be done in a separate commit. Closes #23370 --------- Signed-off-by: Ryan Dahl <ry@tinyclouds.org> Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Ryan Dahl <ry@tinyclouds.org> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-05-28fix(ext/http): flush gzip streaming response (#23991)Bartek Iwańczuk
This commit changes `gzip` compression in `Deno.serve` API to flush data after each write. There's a slight performance regression, but provided test shows a scenario that was not possible before. --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-05-23feat(ext/fetch): `Request.bytes()` and `Response.bytes()` (#23823)Asher Gomez
Closes #23790
2024-04-29fix(ext/http): ensure signal is created iff requested (#23601)Matt Mastracci
This correctly creates the `AbortSignal` regardless of when we request it. If the signal is requested after the request has completed, the signal is created in the aborted state. Using GC counts, we can see a reduction in object creation: This PR: 440 deno 1.42.4: 1650 deno 1.43.0+b02ffec: 874
2024-04-24fix(ext/net): check for TLS using undefined rather than using ReflectHas ↵Matt Mastracci
(#23538) Fixes #23537
2024-04-24feat(ext/http): Implement request.signal for Deno.serve (#23425)Matt Mastracci
When the response has been successfully send, we abort the `Request.signal` property to indicate that all resources associated with this transaction may be torn down.
2024-04-19feat(ext/http): Add `addr` to HttpServer (#23442)Matt Mastracci
Adds an `addr` field to `HttpServer` to simplify the pattern `Deno.serve({ onListen({ port } => listenPort = port })`. This becomes: `const server = Deno.serve({}); port = server.addr.port`. Changes: - Refactors `serve` overloads to split TLS out (in preparation for landing a place for the TLS SNI information) - Adds an `addr` field to `HttpServer` that matches the `addr` field of the corresponding `Deno.Listener`s.
2024-03-07fix(ext/node): http2.createServer (#22708)Satya Rohith
2024-02-13chore: use `@std` import instead of `@test_util/std` (#22398)Asher Gomez
This PR: 1. Replaces `@test_util/std`-prefixed imports with `@std`. 2. Adds `@std/` import map entries to a few `deno.json` files.
2024-02-10chore: move cli/tests/ -> tests/ (#22369)Matt Mastracci
This looks like a massive PR, but it's only a move from cli/tests -> tests, and updates of relative paths for files. This is the first step towards aggregate all of the integration test files under tests/, which will lead to a set of integration tests that can run without the CLI binary being built. While we could leave these tests under `cli`, it would require us to keep a more complex directory structure for the various test runners. In addition, we have a lot of complexity to ignore various test files in the `cli` project itself (cargo publish exclusion rules, autotests = false, etc). And finally, the `tests/` folder will eventually house the `test_ffi`, `test_napi` and other testing code, reducing the size of the root repo directory. For easier review, the extremely large and noisy "move" is in the first commit (with no changes -- just a move), while the remainder of the changes to actual files is in the second commit.