mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 02:11:10 +01:00
Cookie Support (#19)
This commit is contained in:
@@ -9,7 +9,14 @@ export const AUTH_TYPE_NONE = null;
|
||||
export const AUTH_TYPE_BASIC = 'basic';
|
||||
export const AUTH_TYPE_BEARER = 'bearer';
|
||||
|
||||
export type Model = Settings | Workspace | HttpRequest | HttpResponse | KeyValue | Environment;
|
||||
export type Model =
|
||||
| Settings
|
||||
| Workspace
|
||||
| HttpRequest
|
||||
| HttpResponse
|
||||
| KeyValue
|
||||
| Environment
|
||||
| CookieJar;
|
||||
|
||||
export interface BaseModel {
|
||||
readonly id: string;
|
||||
@@ -34,6 +41,33 @@ export interface Workspace extends BaseModel {
|
||||
settingRequestTimeout: number;
|
||||
}
|
||||
|
||||
export interface CookieJar extends BaseModel {
|
||||
readonly model: 'cookie_jar';
|
||||
workspaceId: string;
|
||||
name: string;
|
||||
cookies: Cookie[];
|
||||
}
|
||||
|
||||
export interface Cookie {
|
||||
raw_cookie: string;
|
||||
domain: { HostOnly: string } | { Suffix: string } | 'NotPresent' | 'Empty';
|
||||
expires: { AtUtc: string } | 'SessionEnd';
|
||||
path: [string, boolean];
|
||||
}
|
||||
|
||||
export function cookieDomain(cookie: Cookie): string {
|
||||
if (cookie.domain === 'NotPresent' || cookie.domain === 'Empty') {
|
||||
return 'n/a';
|
||||
}
|
||||
if ('HostOnly' in cookie.domain) {
|
||||
return cookie.domain.HostOnly;
|
||||
}
|
||||
if ('Suffix' in cookie.domain) {
|
||||
return cookie.domain.Suffix;
|
||||
}
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
export interface EnvironmentVariable {
|
||||
name: string;
|
||||
value: string;
|
||||
|
||||
Reference in New Issue
Block a user