From 8e1be624d28aa083f0d54cf610a5d11014c33e4d Mon Sep 17 00:00:00 2001 From: eggate <58251298+eggate@users.noreply.github.com> Date: Thu, 12 Mar 2020 00:17:20 +0200 Subject: [PATCH] fix: apply ignore case for servers return lower case cookies (#24) --- lib/src/requests.dart | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/src/requests.dart b/lib/src/requests.dart index 3a2649f..50ff561 100644 --- a/lib/src/requests.dart +++ b/lib/src/requests.dart @@ -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 _extractResponseCookies(responseHeaders) { @@ -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;