Skip to content

Commit

Permalink
prepare actix-web-lab release 0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Jan 14, 2022
1 parent b97d775 commit 5a0c817
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
## Unreleased - 2021-xx-xx


## 0.2.3 - 2022-01-14
- No significant changes since `0.2.2`.


## 0.2.2 - 2022-01-05
- Fix exports.
- Exclude default Actix Web features.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "actix-web-lab"
version = "0.2.2"
version = "0.2.3"
authors = ["Rob Ede <robjtede@icloud.com>"]
description = "In-progress extractors and middleware for Actix Web"
keywords = ["actix", "http", "web", "framework", "async"]
Expand All @@ -17,7 +17,7 @@ edition = "2021"
rust-version = "1.57"

[dependencies]
actix-web = { version = "4.0.0-beta.19", default-features = false }
actix-web = { version = "4.0.0-beta.20", default-features = false }

derive_more = "0.99.5"
futures-core = "0.3.7"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
> Experimental extractors, middleware, and other extras for possible inclusion in Actix Web.
[![crates.io](https://img.shields.io/crates/v/actix-web-lab?label=latest)](https://crates.io/crates/actix-web-lab)
[![Documentation](https://docs.rs/actix-web-lab/badge.svg)](https://docs.rs/actix-web-lab/0.2.2)
[![Documentation](https://docs.rs/actix-web-lab/badge.svg)](https://docs.rs/actix-web-lab/0.2.3)
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-web-lab.svg)
<br />
[![dependency status](https://deps.rs/crate/actix-web-lab/0.2.2/status.svg)](https://deps.rs/crate/actix-web-lab/0.2.2)
[![dependency status](https://deps.rs/crate/actix-web-lab/0.2.3/status.svg)](https://deps.rs/crate/actix-web-lab/0.2.3)
[![Download](https://img.shields.io/crates/d/actix-web-lab.svg)](https://crates.io/crates/actix-web-lab)
[![CircleCI](https://circleci.com/gh/robjtede/actix-web-lab/tree/main.svg?style=shield)](https://circleci.com/gh/robjtede/actix-web-lab/tree/main)

Expand Down
18 changes: 4 additions & 14 deletions src/guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

use actix_web::{
guard::{Guard, GuardContext},
http::header::{Accept, Header, ACCEPT},
test::TestRequest,
http::header::Accept,
};

/// A guard that verifies that an `Accept` header is present and it contains a compatible mime type.
Expand Down Expand Up @@ -45,18 +44,9 @@ impl Acceptable {

impl Guard for Acceptable {
fn check(&self, ctx: &GuardContext) -> bool {
let headers = ctx.head().headers().get_all(ACCEPT);

// HACK: guard context could do with a way to parse typed headers
let req = headers
.fold(TestRequest::default(), |req, hdr| {
req.append_header((ACCEPT, hdr))
})
.to_http_request();

let accept = match Accept::parse(&req) {
Ok(hdr) => hdr,
Err(_) => return false,
let accept = match ctx.header::<Accept>() {
Some(hdr) => hdr,
None => return false,
};

let target_type = self.mime.type_();
Expand Down

0 comments on commit 5a0c817

Please sign in to comment.