-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finagle-base-http: Remove a side effect of c.t.f.http.Message#cookies
Problem Accessing the `cookies` field of a `Message` may add an empty `Cookie` entry in its `headerMap`: ``` import com.twitter.finagle.http.Request val request = Request() request.headerMap // Map() request.cookies request.headerMap // Map(Cookie -> ) ``` This behavior is unexpected because `.cookies` should be without any side effect. It only happens when the lazy `cookies` field of a `Message` is accessed for the first time, i.e. during the initialization of a `CookieMap`. Solution Call the header resetting logic in `CookieMap#rewriteCookieHeaders` only when there exist some cookie(s) in the cookie map. This solution not only resolves the problem above, but also removes the `Cookie` header of a `Message` whenever its cookie map becomes empty. JIRA Issues: CSL-8743 Differential Revision: https://phabricator.twitter.biz/D361326
- Loading branch information
1 parent
0a7fefd
commit f9b76a0
Showing
3 changed files
with
30 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters