[−][src]Struct saphir::header::Origin
The Origin
header.
The Origin
header is a version of the Referer
header that is used for all HTTP fetches and POST
s whose CORS flag is set.
This header is often used to inform recipients of the security context of where the request was initiated.
Following the spec, https://fetch.spec.whatwg.org/#origin-header, the value of this header is composed of a String (scheme), header::Host (host/port)
Examples
use hyperx::header::{Headers, Origin}; let mut headers = Headers::new(); headers.set( Origin::new("http", "hyper.rs", None) );
use hyperx::header::{Headers, Origin}; let mut headers = Headers::new(); headers.set( Origin::new("https", "wikipedia.org", Some(443)) );
Methods
impl Origin
[src]
pub fn new<S, H>(scheme: S, hostname: H, port: Option<u16>) -> Origin where
H: Into<Cow<'static, str>>,
S: Into<Cow<'static, str>>,
[src]
H: Into<Cow<'static, str>>,
S: Into<Cow<'static, str>>,
Creates a new Origin
header.
pub fn null() -> Origin
[src]
Creates a Null
Origin
header.
pub fn is_null(&self) -> bool
[src]
Checks if Origin
is Null
.
pub fn scheme(&self) -> Option<&str>
[src]
The scheme, such as http or https.
use hyperx::header::Origin; let origin = Origin::new("https", "foo.com", Some(443)); assert_eq!(origin.scheme(), Some("https"));
pub fn host(&self) -> Option<&Host>
[src]
The host, such as Host { hostname: "hyper.rs".to_owned(), port: None}
.
use hyperx::header::{Origin,Host}; let origin = Origin::new("https", "foo.com", Some(443)); assert_eq!(origin.host(), Some(&Host::new("foo.com", Some(443))));
Trait Implementations
impl Clone for Origin
[src]
fn clone(&self) -> Origin
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Header for Origin
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Origin, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl PartialEq<Origin> for Origin
[src]
impl Display for Origin
[src]
impl Debug for Origin
[src]
impl FromStr for Origin
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,