Skip to content

Commit

Permalink
fix: update deps, cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
izatop committed Jul 7, 2022
1 parent 5ad9925 commit 929c41a
Show file tree
Hide file tree
Showing 3 changed files with 509 additions and 541 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@types/jest": "^28.1.4",
"@types/node": "^18.0.1",
"@typescript-eslint/eslint-plugin": "^5.30.4",
"@typescript-eslint/parser": "^5.30.4",
"@types/node": "^18.0.3",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"cross-env": "^7.0.3",
"eslint": "^8.19.0",
"eslint-plugin-import": "^2.26.0",
Expand All @@ -37,6 +37,6 @@
"typescript": "^4.7.2"
},
"dependencies": {
"lerna": "^5.1.6"
"lerna": "^5.1.8"
}
}
12 changes: 10 additions & 2 deletions packages/web/src/Transport/Response/ResponseAbstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export abstract class ResponseAbstract<T> {
public readonly status?: string;
public readonly type: string = "text/plain";
public readonly encoding: string = "utf-8";
public readonly cookies: Cookie[] = [];

readonly #cookies = new Map<string, Cookie>();
readonly #headers: {[key: string]: string};
#data: Promisify<T>;

Expand All @@ -47,12 +47,20 @@ export abstract class ResponseAbstract<T> {
}
}

public get cookies(): Cookie[] {
return [...this.#cookies.values()];
}

public setContent(data: Promisify<T>): void {
this.#data = data;
}

public setCookie(name: string, value: string, options: CookieOptions): void {
this.cookies.push(new Cookie(name, value, options));
this.#cookies.set(name, new Cookie(name, value, options));
}

public hasCookie(name: string): boolean {
return this.#cookies.has(name);
}

public getHeaders(): Record<any, string> {
Expand Down
Loading

0 comments on commit 929c41a

Please sign in to comment.