Skip to content

Commit 8bdfdcc

Browse files
committed
feat: v4.60.2
1 parent 9b1f8c7 commit 8bdfdcc

File tree

5 files changed

+7
-17
lines changed

5 files changed

+7
-17
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "http-type"
3-
version = "4.60.1"
3+
version = "4.60.2"
44
readme = "README.md"
55
edition = "2024"
66
authors = ["root@ltpp.vip"]

src/http_version/cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn test_http_version_display() {
1616
#[test]
1717
fn test_http_version_default() {
1818
use super::*;
19-
assert_eq!(HttpVersion::default(), HttpVersion::Unknown(String::new()));
19+
assert_eq!(HttpVersion::default(), HttpVersion::HTTP1_1);
2020
}
2121

2222
#[test]

src/http_version/enum.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
/// This enum defines the various HTTP protocol versions supported,
44
/// including HTTP/0.9, HTTP/1.0, HTTP/1.1, HTTP/2, and HTTP/3.
55
/// It also includes an `Unknown` variant for unrecognized versions.
6-
#[derive(Debug, Clone, PartialEq, Eq)]
6+
#[derive(Debug, Clone, PartialEq, Eq, Default)]
77
pub enum HttpVersion {
88
/// HTTP version 0.9
99
HTTP0_9,
1010
/// HTTP version 1.0
1111
HTTP1_0,
1212
/// HTTP version 1.1
13+
#[default]
1314
HTTP1_1,
1415
/// HTTP version 2.0
1516
HTTP2,

src/http_version/impl.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
use crate::*;
22

3-
/// Implements the `Default` trait for `HttpVersion`.
4-
impl Default for HttpVersion {
5-
/// Returns the default `HttpVersion` variant, which is `Unknown` with an empty string.
6-
///
7-
/// # Returns
8-
///
9-
/// The default `HttpVersion` variant.
10-
fn default() -> Self {
11-
Self::Unknown(String::new())
12-
}
13-
}
14-
153
/// Implements the `Display` trait for `HttpVersion`, allowing it to be formatted as a string.
164
impl fmt::Display for HttpVersion {
175
/// Formats the `HttpVersion` variant into its string representation.

src/response/impl.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ use crate::*;
55
/// Returns a new `Response` instance with all fields initialized to their default values.
66
impl Default for Response {
77
fn default() -> Self {
8+
let http_status: HttpStatus = HttpStatus::Ok;
89
Self {
910
version: HttpVersion::default(),
10-
status_code: ResponseStatusCode::default(),
11-
reason_phrase: ResponseReasonPhrase::default(),
11+
status_code: http_status.code(),
12+
reason_phrase: http_status.to_string(),
1213
headers: hash_map_xx_hash3_64(),
1314
body: Vec::new(),
1415
}

0 commit comments

Comments
 (0)