Skip to content

Commit

Permalink
Cookies 1.0 api (#217)
Browse files Browse the repository at this point in the history
The main changes are:

* Use the Cookie and Set-Cookie headers as the sole source-of-truth instead of trying to keep a separate collection of cookies in the message object.
* Introduce a clear distinction between request cookies (key-value pairs set in Cookie header) and response cookies (individual Set-Cookie headers that have attributes like Domain and Path).
  • Loading branch information
kvosper authored Jul 26, 2018
1 parent 64e137c commit 280dafb
Show file tree
Hide file tree
Showing 50 changed files with 1,646 additions and 1,329 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import static com.hotels.styx.api.HttpHeaderNames.CONTENT_LENGTH;
import static com.hotels.styx.api.HttpHeaderNames.CONTENT_TYPE;
import static com.hotels.styx.api.support.CookiesSupport.findCookie;

/**
* All behaviour common to both full requests and full responses.
Expand All @@ -43,13 +42,6 @@ public interface FullHttpMessage {
*/
HttpHeaders headers();

/**
* Return all cookies in this response.
*
* @return all cookies.
*/
List<HttpCookie> cookies();

/**
* Returns the body of this message in its unencoded form.
*
Expand Down Expand Up @@ -89,16 +81,6 @@ default List<String> headers(CharSequence name) {
return headers().getAll(name);
}

/**
* Return the single cookie with the specified {@code name}.
*
* @param name cookie name
* @return the cookie if present
*/
default Optional<HttpCookie> cookie(String name) {
return findCookie(cookies(), name);
}

/**
* Return the {@code 'Content-Length'} header value.
*
Expand Down
Loading

0 comments on commit 280dafb

Please sign in to comment.