Skip to content

Commit

Permalink
js-service: remove fragment from http request parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ozwaldorf committed May 3, 2024
1 parent ca96122 commit fb213df
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions services/js-poc/src/http/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ pub fn extract(
path.push('/');
}

let frag = url.fragment().map(|f| f.to_string());

let body = (!body.is_empty())
.then(|| {
// Parse input as a json value
Expand Down Expand Up @@ -69,7 +67,6 @@ pub fn extract(
"method": method,
"headers": headers,
"path": path,
"fragment": frag,
"query": query,
"body": body,
}));
Expand Down Expand Up @@ -103,7 +100,6 @@ mod tests {
"method": "Get",
"headers": null,
"path": "/",
"fragment": null,
"query": null,
"body": null,
})),
Expand All @@ -126,7 +122,6 @@ mod tests {
"method": "Get",
"headers": null,
"path": "/",
"fragment": null,
"query": null,
"body": "foobar",
})),
Expand All @@ -149,7 +144,6 @@ mod tests {
"method": "Get",
"headers": null,
"path": "/",
"fragment": null,
"query": null,
"body": { "foo": "bar" },
})),
Expand All @@ -172,7 +166,6 @@ mod tests {
"method": "Get",
"headers": null,
"path": "/a",
"fragment": null,
"query": null,
"body": null,
})),
Expand All @@ -195,7 +188,6 @@ mod tests {
"method": "Post",
"headers": null,
"path": "/a/b",
"fragment": null,
"query": null,
"body": null,
})),
Expand All @@ -218,30 +210,6 @@ mod tests {
"method": "Get",
"headers": null,
"path": "/a/b",
"fragment": null,
"query": { "a": "4" },
"body": null,
})),
})
);

// Request with path, a query parameter, and a url fragment
assert_eq!(
extract(
&Url::parse("http://fleek/blake3/content-hash/a/b?a=4#hello").unwrap(),
&HashMap::new(),
HttpMethod::GET,
vec![],
),
Some(Request {
origin: Origin::Blake3,
uri: "content-hash".to_string(),
path: Some("/a/b".to_string()),
param: Some(json!({
"method": "Get",
"headers": null,
"path": "/a/b",
"fragment": "hello",
"query": { "a": "4" },
"body": null,
})),
Expand Down

0 comments on commit fb213df

Please sign in to comment.