1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-05 13:59:01 -05:00

enable a test case 'ClientRequest search params'

This commit is contained in:
Yoshiya Hinosawa 2024-10-03 17:58:25 +09:00
parent 007b5265b8
commit 8d41fbc2da
No known key found for this signature in database
GPG key ID: 9017DB4559488785
2 changed files with 9 additions and 8 deletions

View file

@ -167,9 +167,11 @@ where
let mut request = http::Request::new(body);
*request.method_mut() = method.clone();
*request.uri_mut() = url_parsed
.path()
.to_string()
let path = url_parsed.path();
let query = url_parsed.query();
*request.uri_mut() = query
.map(|q| format!("{}?{}", path, q))
.unwrap_or_else(|| path.to_string())
.parse()
.map_err(|_| type_error("Invalid URL"))?;
*request.headers_mut() = header_map;

View file

@ -794,14 +794,13 @@ 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", async () => {
let body = "";
const { promise, resolve, reject } = Promise.withResolvers<void>();
const req = http.request({
host: "localhost:4545",
path: "search_params?foo=bar",
host: "localhost",
port: 4545,
path: "/search_params?foo=bar",
}, (resp) => {
resp.on("data", (chunk) => {
body += chunk;