Skip to content

Commit

Permalink
fix: apply ignore case for servers return lower case cookies (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
eggate authored Mar 11, 2020
1 parent ea191c8 commit 8e1be62
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/src/requests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ class Requests {
RequestBodyEncoding.FormURLEncoded;

static Set _cookiesKeysToIgnore = Set.from([
"SameSite",
"Path",
"Domain",
"Max-Age",
"Expires",
"Secure",
"HttpOnly"
"samesite",
"path",
"domain",
"max-age",
"expires",
"secure",
"httponly"
]);

static Map<String, String> _extractResponseCookies(responseHeaders) {
Expand All @@ -84,11 +84,11 @@ class Requests {
if (Common.equalsIgnoreCase(key, 'set-cookie')) {
String cookie = responseHeaders[key];
cookie.split(",").forEach((String one) {
cookie
one
.split(";")
.map((x) => x.trim().split("="))
.where((x) => x.length == 2)
.where((x) => !_cookiesKeysToIgnore.contains(x[0]))
.where((x) => !_cookiesKeysToIgnore.contains(x[0].toLowerCase()))
.forEach((x) => cookies[x[0]] = x[1]);
});
break;
Expand Down

0 comments on commit 8e1be62

Please sign in to comment.