mirror of https://github.com/fafhrd91/actix-web
add location typed header
This commit is contained in:
parent
342242a0e7
commit
f5d340878c
|
@ -4,6 +4,7 @@
|
|||
|
||||
- Minimum supported Rust version (MSRV) is now 1.75.
|
||||
- Add `http::header::ContentLocation` typed header.
|
||||
- Add `http::header::Location` typed header.
|
||||
|
||||
## 4.9.0
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
use super::{Uri, LOCATION};
|
||||
|
||||
crate::http::header::common_header! {
|
||||
/// `Location` header, defined
|
||||
/// in [RFC 7231 §7.1.2](https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.2)
|
||||
///
|
||||
/// The "Location" header field is used in some responses to refer to a
|
||||
/// specific resource in relation to the response. The type of
|
||||
/// relationship is defined by the combination of request method and
|
||||
/// status code semantics.
|
||||
///
|
||||
/// # ABNF
|
||||
/// ```plain
|
||||
/// Location = URI-reference
|
||||
/// ```
|
||||
///
|
||||
/// # Example Values
|
||||
/// * `http://www.example.org/hypertext/Overview.html`
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use actix_web::HttpResponse;
|
||||
/// use actix_http::Uri;
|
||||
/// use actix_web::http::header::Location;
|
||||
///
|
||||
/// let mut builder = HttpResponse::Ok();
|
||||
/// builder.insert_header(
|
||||
/// Location("http://www.example.org".parse::<Uri>().unwrap())
|
||||
/// );
|
||||
/// ```
|
||||
(Location, LOCATION) => [Uri]
|
||||
|
||||
test_parse_and_format {
|
||||
crate::http::header::common_header_test!(test1, [b"http://www.example.org/hypertext/Overview.html"]);
|
||||
}
|
||||
}
|
|
@ -40,6 +40,7 @@ mod if_none_match;
|
|||
mod if_range;
|
||||
mod if_unmodified_since;
|
||||
mod last_modified;
|
||||
mod location;
|
||||
mod macros;
|
||||
mod preference;
|
||||
mod range;
|
||||
|
@ -71,6 +72,7 @@ pub use self::{
|
|||
if_range::IfRange,
|
||||
if_unmodified_since::IfUnmodifiedSince,
|
||||
last_modified::LastModified,
|
||||
location::Location,
|
||||
preference::Preference,
|
||||
range::{ByteRangeSpec, Range},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue