mirror of https://github.com/fafhrd91/actix-web
Compare commits
7 Commits
13c4fb567e
...
5cd3ea40a8
Author | SHA1 | Date |
---|---|---|
|
5cd3ea40a8 | |
|
a2a8edb3a5 | |
|
e1b204bb2a | |
|
33b487e854 | |
|
182055bcb5 | |
|
a36280466c | |
|
8690f80a08 |
|
@ -49,7 +49,7 @@ jobs:
|
||||||
toolchain: ${{ matrix.version.version }}
|
toolchain: ${{ matrix.version.version }}
|
||||||
|
|
||||||
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||||
uses: taiki-e/install-action@v2.47.18
|
uses: taiki-e/install-action@v2.48.1
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ jobs:
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
||||||
|
|
||||||
- name: Install just, cargo-hack
|
- name: Install just, cargo-hack
|
||||||
uses: taiki-e/install-action@v2.47.18
|
uses: taiki-e/install-action@v2.48.1
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-hack
|
tool: just,cargo-hack
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ jobs:
|
||||||
toolchain: ${{ matrix.version.version }}
|
toolchain: ${{ matrix.version.version }}
|
||||||
|
|
||||||
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||||
uses: taiki-e/install-action@v2.47.18
|
uses: taiki-e/install-action@v2.48.1
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ jobs:
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
|
|
||||||
- name: Install just
|
- name: Install just
|
||||||
uses: taiki-e/install-action@v2.47.18
|
uses: taiki-e/install-action@v2.48.1
|
||||||
with:
|
with:
|
||||||
tool: just
|
tool: just
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ jobs:
|
||||||
components: llvm-tools
|
components: llvm-tools
|
||||||
|
|
||||||
- name: Install just, cargo-llvm-cov, cargo-nextest
|
- name: Install just, cargo-llvm-cov, cargo-nextest
|
||||||
uses: taiki-e/install-action@v2.47.18
|
uses: taiki-e/install-action@v2.48.1
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-llvm-cov,cargo-nextest
|
tool: just,cargo-llvm-cov,cargo-nextest
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ jobs:
|
||||||
run: just test-coverage-codecov
|
run: just test-coverage-codecov
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: codecov/codecov-action@v5.1.2
|
uses: codecov/codecov-action@v5.3.1
|
||||||
with:
|
with:
|
||||||
files: codecov.json
|
files: codecov.json
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
|
|
@ -77,12 +77,12 @@ jobs:
|
||||||
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
|
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
|
||||||
|
|
||||||
- name: Install just
|
- name: Install just
|
||||||
uses: taiki-e/install-action@v2.47.18
|
uses: taiki-e/install-action@v2.48.1
|
||||||
with:
|
with:
|
||||||
tool: just
|
tool: just
|
||||||
|
|
||||||
- name: Install cargo-check-external-types
|
- name: Install cargo-check-external-types
|
||||||
uses: taiki-e/cache-cargo-install-action@v2.0.1
|
uses: taiki-e/cache-cargo-install-action@v2.1.0
|
||||||
with:
|
with:
|
||||||
tool: cargo-check-external-types
|
tool: cargo-check-external-types
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ fn hex_pair_to_char(d1: u8, d2: u8) -> Option<u8> {
|
||||||
let d_low = char::from(d2).to_digit(16)?;
|
let d_low = char::from(d2).to_digit(16)?;
|
||||||
|
|
||||||
// left shift high nibble by 4 bits
|
// left shift high nibble by 4 bits
|
||||||
Some((d_high as u8) << 4 | (d_low as u8))
|
Some(((d_high as u8) << 4) | (d_low as u8))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
|
|
|
@ -1021,6 +1021,7 @@ impl ResourceDef {
|
||||||
panic!("prefix resource definitions should not have tail segments");
|
panic!("prefix resource definitions should not have tail segments");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::literal_string_with_formatting_args)]
|
||||||
if unprocessed.ends_with('*') {
|
if unprocessed.ends_with('*') {
|
||||||
// unnamed tail segment
|
// unnamed tail segment
|
||||||
|
|
||||||
|
@ -1369,6 +1370,7 @@ mod tests {
|
||||||
assert_eq!(path.unprocessed(), "");
|
assert_eq!(path.unprocessed(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[expect(clippy::literal_string_with_formatting_args)]
|
||||||
#[test]
|
#[test]
|
||||||
fn newline_patterns_and_paths() {
|
fn newline_patterns_and_paths() {
|
||||||
let re = ResourceDef::new("/user/a\nb");
|
let re = ResourceDef::new("/user/a\nb");
|
||||||
|
|
|
@ -145,6 +145,7 @@ mod tests {
|
||||||
};
|
};
|
||||||
|
|
||||||
#[allow(clippy::cognitive_complexity)]
|
#[allow(clippy::cognitive_complexity)]
|
||||||
|
#[expect(clippy::literal_string_with_formatting_args)]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_recognizer_1() {
|
fn test_recognizer_1() {
|
||||||
let mut router = Router::<usize>::build();
|
let mut router = Router::<usize>::build();
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Implement `Responder` for `Result<(), E: Into<Error>>`. Returning `Ok(())` responds with HTTP 204 No Content.
|
||||||
- On Windows, an error is now returned from `HttpServer::bind()` (or TLS variants) when binding to a socket that's already in use.
|
- On Windows, an error is now returned from `HttpServer::bind()` (or TLS variants) when binding to a socket that's already in use.
|
||||||
- Update `brotli` dependency to `7`.
|
- Update `brotli` dependency to `7`.
|
||||||
- Minimum supported Rust version (MSRV) is now 1.75.
|
- Minimum supported Rust version (MSRV) is now 1.75.
|
||||||
- Implemented responder for `Option<()>` and `Result<(), E: Error> to respond with `204 No Content`
|
|
||||||
|
|
||||||
## 4.9.0
|
## 4.9.0
|
||||||
|
|
||||||
|
|
|
@ -116,17 +116,6 @@ impl<R: Responder> Responder for Option<R> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Note see https://github.com/actix/actix-web/issues/1108 on why Responder is not implemented for ()
|
|
||||||
impl Responder for Option<()> {
|
|
||||||
type Body = BoxBody;
|
|
||||||
fn respond_to(self, _req: &HttpRequest) -> HttpResponse {
|
|
||||||
match self {
|
|
||||||
Some(()) => HttpResponse::NoContent().finish(),
|
|
||||||
None => HttpResponse::NotFound().finish(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<R, E> Responder for Result<R, E>
|
impl<R, E> Responder for Result<R, E>
|
||||||
where
|
where
|
||||||
R: Responder,
|
R: Responder,
|
||||||
|
@ -142,14 +131,19 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Note see https://github.com/actix/actix-web/issues/1108 on why Responder is not implemented for ()
|
// Note: see https://github.com/actix/actix-web/issues/1108 for reasoning why Responder is not
|
||||||
impl<E: Into<Error>> Responder for Result<(), E> {
|
// implemented for `()`, and https://github.com/actix/actix-web/pull/3560 for discussion about this
|
||||||
|
// impl and the decision not to include a similar one for `Option<()>`.
|
||||||
|
impl<E> Responder for Result<(), E>
|
||||||
|
where
|
||||||
|
E: Into<Error>,
|
||||||
|
{
|
||||||
type Body = BoxBody;
|
type Body = BoxBody;
|
||||||
|
|
||||||
fn respond_to(self, _req: &HttpRequest) -> HttpResponse {
|
fn respond_to(self, _req: &HttpRequest) -> HttpResponse {
|
||||||
match self {
|
match self {
|
||||||
Ok(()) => HttpResponse::new(StatusCode::NO_CONTENT),
|
Ok(()) => HttpResponse::new(StatusCode::NO_CONTENT),
|
||||||
Err(e) => HttpResponse::from_error(e.into()),
|
Err(err) => HttpResponse::from_error(err.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue