1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-12 10:37:52 -05:00
This commit is contained in:
Yoshiya Hinosawa 2024-09-26 13:31:06 +09:00
parent a32ea23dea
commit 33c4efac51
No known key found for this signature in database
GPG key ID: 9017DB4559488785
2 changed files with 126 additions and 125 deletions

View file

@ -333,7 +333,10 @@ pub fn take_network_stream_resource(
if let Ok(resource_rc) = resource_table.take::<TcpStreamResource>(stream_rid)
{
// This TCP connection might be used somewhere else.
let resource: crate::io::FullDuplexResource<tokio::net::tcp::OwnedReadHalf, tokio::net::tcp::OwnedWriteHalf> = Rc::try_unwrap(resource_rc)
let resource: crate::io::FullDuplexResource<
tokio::net::tcp::OwnedReadHalf,
tokio::net::tcp::OwnedWriteHalf,
> = Rc::try_unwrap(resource_rc)
.map_err(|_| bad_resource("TCP stream is currently in use"))?;
let (read_half, write_half) = resource.into_inner();
let tcp_stream = read_half.reunite(write_half)?;

View file

@ -452,10 +452,9 @@ Deno.test("[node/http] http.IncomingMessage can be created without url", () => {
});
*/
Deno.test(
"[node/http] send request with non-chunked body",
{ ignore: true },
async () => {
Deno.test("[node/http] send request with non-chunked body", {
ignore: true,
}, async () => {
let requestHeaders: Headers;
let requestBody = "";
@ -512,8 +511,7 @@ Deno.test(
// in order to not cause a flaky test sanitizer failure
await new Promise((resolve) => setTimeout(resolve, 100)),
]);
},
);
});
Deno.test("[node/http] send request with chunked body", async () => {
let requestHeaders: Headers;
@ -694,10 +692,9 @@ Deno.test("[node/http] ClientRequest handle non-string headers", {
assertEquals(headers!["1"], "2");
});
Deno.test(
"[node/http] ClientRequest uses HTTP/1.1",
{ ignore: true },
async () => {
Deno.test("[node/http] ClientRequest uses HTTP/1.1", {
ignore: true,
}, async () => {
let body = "";
const { promise, resolve, reject } = Promise.withResolvers<void>();
const req = https.request("https://localhost:5545/http_version", {
@ -717,8 +714,7 @@ Deno.test(
await promise;
console.log(body);
assertEquals(body, "HTTP/1.1");
},
);
});
Deno.test("[node/http] ClientRequest setTimeout", async () => {
let body = "";
@ -806,10 +802,9 @@ Deno.test("[node/http] ClientRequest PUT", async () => {
assertEquals(body, "hello world");
});
Deno.test(
"[node/http] ClientRequest search params",
{ ignore: true },
async () => {
Deno.test("[node/http] ClientRequest search params", {
ignore: true,
}, async () => {
let body = "";
const { promise, resolve, reject } = Promise.withResolvers<void>();
const req = http.request({
@ -828,8 +823,7 @@ Deno.test(
req.end();
await promise;
assertEquals(body, "foo=bar");
},
);
});
Deno.test("[node/http] HTTPS server", async () => {
const deferred = Promise.withResolvers<void>();
@ -1025,7 +1019,9 @@ Deno.test(
Deno.test(
"[node/http] client destroy before sending request should not error",
{ ignore: true },
{
ignore: true,
},
() => {
const request = http.request("http://localhost:5929/");
// Calling this would throw
@ -1033,10 +1029,9 @@ Deno.test(
},
);
Deno.test(
"[node/http] destroyed requests should not be sent",
{ ignore: true },
async () => {
Deno.test("[node/http] destroyed requests should not be sent", {
ignore: true,
}, async () => {
let receivedRequest = false;
const server = Deno.serve(() => {
receivedRequest = true;
@ -1049,8 +1044,7 @@ Deno.test(
await new Promise((r) => setTimeout(r, 500));
assertEquals(receivedRequest, false);
await server.shutdown();
},
);
});
Deno.test("[node/http] node:http exports globalAgent", async () => {
const http = await import("node:http");
@ -1078,7 +1072,9 @@ Deno.test("[node/https] node:https exports globalAgent", async () => {
Deno.test(
"[node/http] node:http request.setHeader(header, null) doesn't throw",
{ ignore: true },
{
ignore: true,
},
() => {
{
const req = http.request("http://localhost:4545/");
@ -1634,7 +1630,9 @@ Deno.test("[node/http] In ClientRequest, option.hostname has precedence over opt
Deno.test(
"[node/http] upgraded socket closes when the server closed without closing handshake",
{ ignore: true },
{
ignore: true,
},
async () => {
const clientSocketClosed = Promise.withResolvers<void>();
const serverProcessClosed = Promise.withResolvers<void>();