Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Rust binaries #5339

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: improved the etag util
  • Loading branch information
MathurAditya724 committed Nov 29, 2023
commit 7f3c3a137bb80386acef674dae2a94a12714a092
10 changes: 2 additions & 8 deletions __test__/utils.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ test("utils.wetag(body, encoding)", (t) => {
t.assert(wetag("express!"), 'W/"8-O2uVAFaQ1rZvlKLT14RnuvjPIdg"');

// should support utf8 strings
// t.assert(
// wetag("express❤", "utf8"),
// 'W/"a-JBiXf7GyzxwcrxY4hVXUwa7tmks"'
// );
// t.assert(wetag("express❤", "utf8"), 'W/"a-JBiXf7GyzxwcrxY4hVXUwa7tmks"');

// should support buffer
// t.assert(
// wetag(Buffer.from("express!")),
// 'W/"8-O2uVAFaQ1rZvlKLT14RnuvjPIdg"'
// );
// t.assert(wetag(Buffer.from("express!")), 'W/"8-O2uVAFaQ1rZvlKLT14RnuvjPIdg"');

// should support empty string
t.assert(wetag(""), 'W/"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"');
Expand Down
10 changes: 1 addition & 9 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ pub fn compile_e_tag() {}
// the given options.
fn create_e_tag_generator(weak: bool) -> impl Fn(String, Option<String>) -> String {
return move |body: String, encoding: Option<String>| -> String {
let tag;

if weak {
tag = etag::EntityTag::weak(&body);
} else {
tag = etag::EntityTag::strong(&body);
}

return tag.to_string();
return etag::EntityTag::new(weak, &body).to_string();
};
}