summaryrefslogtreecommitdiff
path: root/tests/unit_node/http_test.ts
AgeCommit message (Collapse)Author
2024-10-29Revert "fix(ext/node): fix dns.lookup result ordering (#26264)" (#26621)Yoshiya Hinosawa
This reverts commit d59599fc187c559ee231882773e1c5a2b932fc3d. Closes #26588
2024-10-25fix(ext/node): refactor http.ServerResponse into function class (#26210)Nicola Bovolato
While testing, I found out that light-my-request relies on `ServerResponse.connection`, which is deprecated, so I added that and `socket`, the non deprecated property. It also relies on an undocumented `_header` property, apparently for [raw header processing](https://github.com/fastify/light-my-request/blob/v6.1.0/lib/response.js#L180-L186). I added it as an empty string, feel free to provide other approaches. Fixes #19901 Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-17fix(node/http): normalize header names in `ServerResponse` (#26339)Nathan Whitaker
Fixes https://github.com/denoland/deno/issues/26115. We weren't normalizing the headers to lower case, so code that attempted to delete the `Content-Length` header (but used a different case) wasn't actually removing the header.
2024-10-16fix(ext/node): fix dns.lookup result ordering (#26264)Yoshiya Hinosawa
partially unblocks #25470 This PR aligns the resolution of `localhost` hostname to Node.js behavior. In Node.js `dns.lookup("localhost", (_, addr) => console.log(addr))` prints ipv6 address `::1`, but it prints ipv4 address `127.0.0.1` in Deno. That difference causes some errors in the work of enabling `createConnection` option in `http.request` (#25470). This PR fixes the issue by aligning `dns.lookup` behavior to Node.js. This PR also changes the following behaviors (resolving TODOs): - `http.createServer` now listens on ipv6 address `[::]` by default on linux/mac - `net.createServer` now listens on ipv6 address `[::]` by default on linux/mac These changes are also alignments to Node.js behaviors.
2024-09-05fix(ext/node): close upgraded socket when the underlying http connection is ↵Yoshiya Hinosawa
closed (#25387) This change fixes the handling of upgraded socket from `node:http` module. In `op_node_http_fetch_response_upgrade`, we create DuplexStream paired with `hyper::upgrade::Upgraded`. When the connection is closed from the server, the read result from `Upgraded` becomes 0. However because we don't close the paired DuplexStream at that point, the Socket object in JS side keeps alive even after the server closed. That caused the issue #20179 This change fixes it by closing the paired DuplexStream when the `Upgraded` stream returns 0 read result. closes #20179
2024-08-30test(ext/node): check hostname option has precedence over host option (#25292)Yoshiya Hinosawa
2024-08-21fix(ext/node): pass content-disposition header as string instead of bytes ↵Satya Rohith
(#25128) Closes https://github.com/denoland/deno/issues/25117
2024-08-20chore: enable no-console dlint rule (#25113)David Sherret
2024-08-18fix(node/http): wrong `req.url` value (#25081)Marvin Hagemeister
This PR addresses a regression introduced in https://github.com/denoland/deno/pull/25021 that would cause the `req.url` parameter in Node's http server to always be a single character instead of the expected value. The regression was caused by effectively calling `.indexOf()` on an empty string and thus passing the wrong index for slicing. ```js "".indexOf("/") // -> -1 request.url.slice(-1) // effectively only giving us the last character ``` Fixes https://github.com/denoland/deno/issues/25080
2024-08-12fix(ext/node): don't concat set-cookie in ServerResponse.appendHeader (#25000)Luca Casonato
Follow-on to https://github.com/denoland/deno/pull/24216/files#r1642188672
2024-08-08fix(ext/node): client closing streaming request shouldn't terminate http ↵Satya Rohith
server (#24946) Closes https://github.com/denoland/deno/issues/22820
2024-07-27test(ext/node): reduce http_test flakiness (#24742)Yoshiya Hinosawa
2024-07-25chore: update to `std@2024.07.19` (#24715)Asher Gomez
2024-07-24fix(ext/node/net): emit `error` before `close` when connection is refused ↵Yoshiya Hinosawa
(#24656)
2024-07-16fix(ext/node): http request uploads of subarray of buffer should work (#24603)Satya Rohith
Closes https://github.com/denoland/deno/issues/24571
2024-07-10fix(node/http): don't send destroyed requests (#24498)Marvin Hagemeister
Make sure that already destroyed requests are not actually sent. This error was discovered in jsdom's test suite.
2024-07-10fix(node/http): don't error if request destroyed before send (#24497)Marvin Hagemeister
A request can be destroyed before it was even made in the Node http API. We errored on that. This issue was discovered in the JSDOM test suite.
2024-07-09fix(node/http): support all `.writeHead()` signatures (#24469)Marvin Hagemeister
Implement the missing `.writeHead()` signatures from Node's `ServerResponse` class that we didn't support. Fixes https://github.com/denoland/deno/issues/24468
2024-07-05fix(ext/node): http chunked writes hangs (#24428)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/24239
2024-07-04fix(node/http): don't throw on .address() before .listen() (#24432)Marvin Hagemeister
It's perfectly valid to access `server.address()` before calling `.listen()`. Until a server actively listens on a socket Node will return `null` here, but we threw a "Cannot access property 'port' of undefined" instead. This was discovered when inspecting failures in Koa's test suite with Deno.
2024-07-03fix(ext/node): don't wait for end() call to send http client request (#24390)Satya Rohith
Closes https://github.com/denoland/deno/issues/24232 Closes https://github.com/denoland/deno/issues/24215
2024-06-25fix(ext/node): ignore stream error during enqueue (#24243)Satya Rohith
2024-06-21fix(ext/node): add ServerResponse#appendHeader (#24216)Divy Srivastava
2024-06-14fix(ext/node): `server.close()` does graceful shutdown (#24184)Divy Srivastava
2024-06-11fix(ext/node): ServerResponse header array handling (#24149)Luca Casonato
Previously res.setHeader("foo", ["bar", "baz"]) added a single header with a value of `bar,baz`. Really this should add two separate headers. This is visible in `set-cookie` for example.
2024-05-26fix(node): set default http server response code 200 (#23977)Marvin Hagemeister
Node sets the default HTTP response status code to 200 on the `ServerResponse`. We initialised it as `undefined` before which caused a problem with 11ty's dev server. Thanks to @vrugtehagel for reporting this issue and finding the correct fix as well 🎉 Fixes https://github.com/denoland/deno/issues/23970
2024-05-23feat(ext/fetch): `Request.bytes()` and `Response.bytes()` (#23823)Asher Gomez
Closes #23790
2024-05-15chore: fix flaky '[node/http] send request with non-chunked body' test (#23818)David Sherret
https://github.com/denoland/deno/actions/runs/9086887959/job/24973565321
2024-04-21fix(ext/node): define http.maxHeaderSize (#23479)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/23432
2024-04-18fix(ext/node): Correctly send ALPN on node TLS connections (#23434)Matt Mastracci
Landing work from #21903, plus fixing a node compat bug. We were always sending the HTTP/2 ALPN on TLS connections which might confuse upstream servers. Changes: - Configure HTTP/2 ALPN when making the TLS connection from the HTTP/2 code - Read the `ALPNProtocols` property from the TLS connection options rather than the deno `alpnProtocols` field - Add tests Prereq for landing Deno.serveHttp on Deno.serve: removing older HTTP servers from the codebase.
2024-04-05fix(ext/node): hostname is valid IPv4 addr (#23243)Divy Srivastava
Fixes `docusaurus serve`
2024-02-29fix(ext/node) add node http methods (#22630)Igor Zinkovsky
fixes #22627 This PR fixes a node compat issue that is preventing `serverless-http` and `serverless-express` npm modules from working with Deno. These modules are useful for running apps on AWS Lambda (and other serverless infra). --------- Signed-off-by: Igor Zinkovsky <igor@deno.com>
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.