summaryrefslogtreecommitdiff
path: root/http/cookie.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-05-30 14:59:30 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-05-30 08:59:30 -0400
commit50a79584cb12129b3db1ef3e0eb9d0c8b9f20b62 (patch)
treeee9a90a8b8018c03b1e1a6ace07abdaa494ea90d /http/cookie.ts
parent80b3c486f6222f65b52eb2eca903b67312e8ce0c (diff)
chore: Implement strict mode (denoland/deno_std#453)
Original: https://github.com/denoland/deno_std/commit/be24677d15494e83eea2e99bfc5ccfdde31cb892
Diffstat (limited to 'http/cookie.ts')
-rw-r--r--http/cookie.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/http/cookie.ts b/http/cookie.ts
index 900d2941b..026ed1984 100644
--- a/http/cookie.ts
+++ b/http/cookie.ts
@@ -45,8 +45,8 @@ function toString(cookie: Cookie): string {
if (cookie.httpOnly) {
out.push("HttpOnly");
}
- if (Number.isInteger(cookie.maxAge)) {
- assert(cookie.maxAge > 0, "Max-Age must be an integer superior to 0");
+ if (Number.isInteger(cookie.maxAge!)) {
+ assert(cookie.maxAge! > 0, "Max-Age must be an integer superior to 0");
out.push(`Max-Age=${cookie.maxAge}`);
}
if (cookie.domain) {
@@ -75,10 +75,10 @@ function toString(cookie: Cookie): string {
export function getCookies(req: ServerRequest): Cookies {
if (req.headers.has("Cookie")) {
const out: Cookies = {};
- const c = req.headers.get("Cookie").split(";");
+ const c = req.headers.get("Cookie")!.split(";");
for (const kv of c) {
const cookieVal = kv.split("=");
- const key = cookieVal.shift().trim();
+ const key = cookieVal.shift()!.trim();
out[key] = cookieVal.join("=");
}
return out;