Skip to content

Commit

Permalink
fix: cookie decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBLT committed Feb 10, 2024
1 parent 100f11c commit 7a15776
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/@hec.js/api/lib/src/routing/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ export class ApiRequest extends Request {
* @returns { string }
*/
cookie(key) {
this.#cookies ??= new URLSearchParams(this.headers.get('cookie') ?? '');
this.#cookies ??= Object.fromEntries(
(this.headers.get('cookie') ?? '').split(';').map(e => e.split('=').map(v => v.trim()))
);

return this.#cookies.get(key);
return this.#cookies[key];
}

/**
Expand Down

0 comments on commit 7a15776

Please sign in to comment.