mirror of
https://github.com/actix/actix-web.git
synced 2024-11-10 02:49:33 +00:00
Merge pull request #245 from svartalf/response-builder-cookies-doc
Updating docs for HttpResponseBuilder::del_cookie
This commit is contained in:
commit
565bcfb561
1 changed files with 16 additions and 3 deletions
|
@ -458,7 +458,6 @@ impl HttpResponseBuilder {
|
||||||
/// .finish())
|
/// .finish())
|
||||||
/// .finish()
|
/// .finish()
|
||||||
/// }
|
/// }
|
||||||
/// fn main() {}
|
|
||||||
/// ```
|
/// ```
|
||||||
pub fn cookie<'c>(&mut self, cookie: Cookie<'c>) -> &mut Self {
|
pub fn cookie<'c>(&mut self, cookie: Cookie<'c>) -> &mut Self {
|
||||||
if self.cookies.is_none() {
|
if self.cookies.is_none() {
|
||||||
|
@ -471,8 +470,22 @@ impl HttpResponseBuilder {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove cookie, cookie has to be cookie from `HttpRequest::cookies()`
|
/// Remove cookie
|
||||||
/// method.
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # extern crate actix_web;
|
||||||
|
/// use actix_web::{http, HttpRequest, HttpResponse, Result};
|
||||||
|
///
|
||||||
|
/// fn index(req: HttpRequest) -> HttpResponse {
|
||||||
|
/// let mut builder = HttpResponse::Ok();
|
||||||
|
///
|
||||||
|
/// if let Some(cookie) = req.cookie("name") {
|
||||||
|
/// builder.del_cookie(cookie);
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// builder.finish()
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub fn del_cookie<'a>(&mut self, cookie: &Cookie<'a>) -> &mut Self {
|
pub fn del_cookie<'a>(&mut self, cookie: &Cookie<'a>) -> &mut Self {
|
||||||
{
|
{
|
||||||
if self.cookies.is_none() {
|
if self.cookies.is_none() {
|
||||||
|
|
Loading…
Reference in a new issue