Skip to content

Commit 43c036d

Browse files
Apply suggestions from code review
Co-authored-by: Jeremiah Senkpiel <[email protected]>
1 parent 65ec6b5 commit 43c036d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/content/accept.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Client header advertising which media types the client is able to understand
1+
//! Client header advertising which media types the client is able to understand.
22
33
use crate::content::{ContentType, MediaTypeProposal};
44
use crate::headers::{HeaderName, HeaderValue, Headers, ToHeaderValues, ACCEPT};
@@ -9,15 +9,15 @@ use std::fmt::{self, Debug, Write};
99
use std::option;
1010
use std::slice;
1111

12-
/// Client header advertising which media types the client is able to understand
12+
/// Client header advertising which media types the client is able to understand.
1313
///
1414
/// Using content negotiation, the server then selects one of the proposals, uses
1515
/// it and informs the client of its choice with the `Content-Type` response
1616
/// header. Browsers set adequate values for this header depending on the context
1717
/// where the request is done: when fetching a CSS stylesheet a different value
1818
/// is set for the request than when fetching an image, video or a script.
1919
///
20-
/// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding)
20+
/// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept)
2121
///
2222
/// # Specifications
2323
///
@@ -34,7 +34,7 @@ use std::slice;
3434
/// let mut accept = Accept::new();
3535
/// accept.push(MediaTypeProposal::new(mime::HTML, Some(0.8))?);
3636
/// accept.push(MediaTypeProposal::new(mime::XML, Some(0.4))?);
37-
/// accept.push(MediaTypeProposal::new(mime::PLAIN, None)?);
37+
/// accept.push(mime::PLAIN);
3838
///
3939
/// let mut res = Response::new(200);
4040
/// let content_type = accept.negotiate(&[mime::XML])?;

src/content/content_type.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{convert::TryInto, str::FromStr};
33
use crate::headers::{HeaderName, HeaderValue, Headers, CONTENT_TYPE};
44
use crate::Mime;
55

6-
/// Indicate the media type of the resource.
6+
/// Indicate the media type of a resource's content.
77
///
88
/// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type)
99
///
@@ -21,7 +21,7 @@ use crate::Mime;
2121
/// use http_types::{Response, Mime};
2222
/// use std::str::FromStr;
2323
///
24-
/// let content_type = ContentType::new(Mime::from_str("text/*")?);
24+
/// let content_type = ContentType::new("text/*");
2525
///
2626
/// let mut res = Response::new(200);
2727
/// content_type.apply(&mut res);

src/content/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
//! let mut accept = Accept::new();
2121
//! accept.push(MediaTypeProposal::new(mime::HTML, Some(0.8))?);
2222
//! accept.push(MediaTypeProposal::new(mime::XML, Some(0.4))?);
23-
//! accept.push(MediaTypeProposal::new(mime::PLAIN, None)?);
23+
//! accept.push(mime::PLAIN);
2424
//!
2525
//! let mut res = Response::new(200);
2626
//! let content_type = accept.negotiate(&[mime::XML])?;

0 commit comments

Comments
 (0)