From f9d5f919fd76988e121296f0bee0beddc6f84d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=A4=E9=9B=A8=E4=B8=9C?= Date: Sun, 29 Dec 2024 19:00:41 +0800 Subject: [PATCH] feat:add key --- Cargo.lock | 61 ++++++++++++++++++++++++++----------- Cargo.toml | 12 ++++---- src/cfg.rs | 30 ++++++++++-------- src/request/request/impl.rs | 2 +- 4 files changed, 68 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 915a812..b32fe9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,9 +67,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "color-output" -version = "4.1.2" +version = "6.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d7e6fcd4e535c57c663834c9fcb758c57303847f7fec4603b7a291d31e087d" +checksum = "ca316d2e04a679560f6335726960e0c5091fc2172fc355b86ce58070d28fc47e" [[package]] name = "core-foundation" @@ -172,14 +172,14 @@ dependencies = [ "brotli", "flate2", "http-constant", - "http-type", + "http-type 1.6.0", ] [[package]] name = "http-constant" -version = "1.9.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5099e3e9a3178368124f83a438d739d0a16622dcbf9e444719e2728721143b4d" +checksum = "d115cecd658be89a5be477ed902f59db94d75cf8554539d9908ab665992a9865" dependencies = [ "brotli", "flate2", @@ -187,7 +187,7 @@ dependencies = [ [[package]] name = "http-request" -version = "8.2.0" +version = "8.4.0" dependencies = [ "brotli", "color-output", @@ -195,7 +195,7 @@ dependencies = [ "hex", "http-compress", "http-constant", - "http-type", + "http-type 2.0.12", "native-tls", "serde", "serde-xml-rs", @@ -221,6 +221,22 @@ dependencies = [ "url", ] +[[package]] +name = "http-type" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66543b32fc5b31206778e6311912368de9cf6f8c5b35c50e21fb7de68c24b72" +dependencies = [ + "hex", + "http-constant", + "lombok-macros", + "serde", + "serde-xml-rs", + "serde_json", + "serde_urlencoded", + "url", +] + [[package]] name = "icu_collections" version = "1.5.0" @@ -390,6 +406,17 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "lombok-macros" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5041b6c8aab2447c573ce9863912c71a0122ccc3189a8457f530d1e790cdae80" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "memchr" version = "2.7.4" @@ -495,9 +522,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -555,9 +582,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] @@ -576,9 +603,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", @@ -629,15 +656,15 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "std-macro-extensions" -version = "0.17.1" +version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "430543e5c343899ea51e93603ca7e4a50542948d3d850f06761757d2a0d1a86c" +checksum = "d07a494891959aae982c75a1ae575f24689e858c50ff086db91581329523f10e" [[package]] name = "syn" -version = "2.0.89" +version = "2.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "9c786062daee0d6db1132800e623df74274a0a87322d8e183338e01b3d98d058" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 336ee9f..4bbabdd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "http-request" -version = "8.2.0" +version = "8.4.0" edition = "2021" authors = ["ltpp-universe "] license = "MIT" @@ -20,10 +20,10 @@ brotli = "7.0.0" flate2 = "1.0.35" hex = "0.4.3" http-compress = "1.0.0" -http-constant = "1.9.0" -http-type = "1.6.0" +http-constant = "1.13.0" +http-type = "2.0.12" native-tls = "0.2.12" -serde = { version = "1.0", features = ["derive"] } +serde = { version = "1.0.217", features = ["derive"] } serde-xml-rs = "0.6.0" serde_json = "1.0.133" serde_urlencoded = "0.7.1" @@ -31,5 +31,5 @@ url = "2.5.4" urlencoding = "2.1.3" [dev-dependencies] -color-output = "4.1.2" -std-macro-extensions = "0.17.1" +color-output = "6.1.3" +std-macro-extensions = "0.17.6" diff --git a/src/cfg.rs b/src/cfg.rs index 62390b8..3e73e31 100644 --- a/src/cfg.rs +++ b/src/cfg.rs @@ -4,19 +4,23 @@ use std_macro_extensions::*; #[allow(dead_code)] fn output(title: &str, msg: &str, color: Color) { - OutputBuilder::new() - .show_time(true) - .time_bg_color(ColorType::Use(Color::Cyan)) - .time_text_blod(true) - .split_text(title) - .split_text_blod(true) - .split_bg_color(ColorType::Use(Color::Yellow)) - .text(msg) - .text_bg_color(ColorType::Use(color)) - .text_blod(true) - .endl(true) - .build() - .output(); + OutputListBuilder::new() + .add( + OutputBuilder::new() + .text(title) + .bg_color(ColorType::Use(Color::Cyan)) + .blod(true) + .build(), + ) + .add( + OutputBuilder::new() + .text(msg) + .bg_color(ColorType::Use(color)) + .blod(true) + .endl(true) + .build(), + ) + .run(); } #[test] diff --git a/src/request/request/impl.rs b/src/request/request/impl.rs index b7161bc..947b9e4 100644 --- a/src/request/request/impl.rs +++ b/src/request/request/impl.rs @@ -115,7 +115,7 @@ impl HttpRequest { &self.get_body_bytes().len().to_string() }, ), - (ACCEPT, ACCEPT_VALUE), + (ACCEPT, ACCEPT_ANY), (USER_AGENT, APP_NAME), ]; for &(key, default_value) in &required_headers {