mirror of
https://github.com/denoland/deno.git
synced 2025-01-06 22:35:51 -05:00
enable a test case 'ClientRequest search params'
This commit is contained in:
parent
007b5265b8
commit
8d41fbc2da
2 changed files with 9 additions and 8 deletions
|
@ -167,9 +167,11 @@ where
|
||||||
|
|
||||||
let mut request = http::Request::new(body);
|
let mut request = http::Request::new(body);
|
||||||
*request.method_mut() = method.clone();
|
*request.method_mut() = method.clone();
|
||||||
*request.uri_mut() = url_parsed
|
let path = url_parsed.path();
|
||||||
.path()
|
let query = url_parsed.query();
|
||||||
.to_string()
|
*request.uri_mut() = query
|
||||||
|
.map(|q| format!("{}?{}", path, q))
|
||||||
|
.unwrap_or_else(|| path.to_string())
|
||||||
.parse()
|
.parse()
|
||||||
.map_err(|_| type_error("Invalid URL"))?;
|
.map_err(|_| type_error("Invalid URL"))?;
|
||||||
*request.headers_mut() = header_map;
|
*request.headers_mut() = header_map;
|
||||||
|
|
|
@ -794,14 +794,13 @@ Deno.test("[node/http] ClientRequest PUT", async () => {
|
||||||
assertEquals(body, "hello world");
|
assertEquals(body, "hello world");
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test("[node/http] ClientRequest search params", {
|
Deno.test("[node/http] ClientRequest search params", async () => {
|
||||||
ignore: true,
|
|
||||||
}, async () => {
|
|
||||||
let body = "";
|
let body = "";
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
const req = http.request({
|
const req = http.request({
|
||||||
host: "localhost:4545",
|
host: "localhost",
|
||||||
path: "search_params?foo=bar",
|
port: 4545,
|
||||||
|
path: "/search_params?foo=bar",
|
||||||
}, (resp) => {
|
}, (resp) => {
|
||||||
resp.on("data", (chunk) => {
|
resp.on("data", (chunk) => {
|
||||||
body += chunk;
|
body += chunk;
|
||||||
|
|
Loading…
Reference in a new issue