-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5022c19
commit 55387ef
Showing
41 changed files
with
1,723 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [(constructor)](./tough-cookie.cookie._constructor_.md) | ||
|
||
## Cookie.(constructor) | ||
|
||
Create a new Cookie instance. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
constructor(options?: CreateCookieOptions); | ||
``` | ||
|
||
## Parameters | ||
|
||
<table><thead><tr><th> | ||
|
||
Parameter | ||
|
||
|
||
</th><th> | ||
|
||
Type | ||
|
||
|
||
</th><th> | ||
|
||
Description | ||
|
||
|
||
</th></tr></thead> | ||
<tbody><tr><td> | ||
|
||
options | ||
|
||
|
||
</td><td> | ||
|
||
CreateCookieOptions | ||
|
||
|
||
</td><td> | ||
|
||
_(Optional)_ The attributes to set on the cookie | ||
|
||
|
||
</td></tr> | ||
</tbody></table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [canonicalizedDomain](./tough-cookie.cookie.canonicalizeddomain.md) | ||
|
||
## Cookie.canonicalizedDomain() method | ||
|
||
Calls [canonicalDomain()](./tough-cookie.canonicaldomain.md) with the [Cookie.domain](./tough-cookie.cookie.domain.md) property. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
canonicalizedDomain(): string | undefined; | ||
``` | ||
**Returns:** | ||
|
||
string \| undefined | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [cdomain](./tough-cookie.cookie.cdomain.md) | ||
|
||
## Cookie.cdomain() method | ||
|
||
Alias for [Cookie.canonicalizedDomain()](./tough-cookie.cookie.canonicalizeddomain.md) | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
cdomain(): string | undefined; | ||
``` | ||
**Returns:** | ||
|
||
string \| undefined | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [clone](./tough-cookie.cookie.clone.md) | ||
|
||
## Cookie.clone() method | ||
|
||
Does a deep clone of this cookie, implemented exactly as `Cookie.fromJSON(cookie.toJSON())`<!-- -->. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
clone(): Cookie | undefined; | ||
``` | ||
**Returns:** | ||
|
||
[Cookie](./tough-cookie.cookie.md) \| undefined | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [cookieString](./tough-cookie.cookie.cookiestring.md) | ||
|
||
## Cookie.cookieString() method | ||
|
||
Encodes to a `Cookie` header value (specifically, the [Cookie.key](./tough-cookie.cookie.key.md) and [Cookie.value](./tough-cookie.cookie.value.md) properties joined with "="). | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
cookieString(): string; | ||
``` | ||
**Returns:** | ||
|
||
string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [creation](./tough-cookie.cookie.creation.md) | ||
|
||
## Cookie.creation property | ||
|
||
Set to the date and time when a Cookie is initially stored or a matching cookie is received that replaces an existing cookie (See [RFC6265 Section 5.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.3)<!-- -->). | ||
|
||
Also used to maintain ordering among cookies. Among cookies that have equal-length path fields, cookies with earlier creation-times are listed before cookies with later creation-times (See [RFC6265 Section 5.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.4)<!-- -->). | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
creation: Date | 'Infinity' | null; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [creationIndex](./tough-cookie.cookie.creationindex.md) | ||
|
||
## Cookie.creationIndex property | ||
|
||
A global counter used to break ordering ties between two cookies that have equal-length path fields and the same creation-time. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
creationIndex: number; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [domain](./tough-cookie.cookie.domain.md) | ||
|
||
## Cookie.domain property | ||
|
||
The 'Domain' attribute of the cookie represents the domain the cookie belongs to (See [RFC6265 Section 5.2.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.3)<!-- -->). | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
domain: string | null; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [expires](./tough-cookie.cookie.expires.md) | ||
|
||
## Cookie.expires property | ||
|
||
The 'Expires' attribute of the cookie (See [RFC6265 Section 5.2.1](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.1)<!-- -->). | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
expires: Date | 'Infinity' | null; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [expiryTime](./tough-cookie.cookie.expirytime.md) | ||
|
||
## Cookie.expiryTime() method | ||
|
||
Computes the absolute unix-epoch milliseconds that this cookie expires. | ||
|
||
The "Max-Age" attribute takes precedence over "Expires" (as per the RFC). The [Cookie.lastAccessed](./tough-cookie.cookie.lastaccessed.md) attribute (or the `now` parameter if given) is used to offset the [Cookie.maxAge](./tough-cookie.cookie.maxage.md) attribute. | ||
|
||
If Expires ([Cookie.expires](./tough-cookie.cookie.expires.md)<!-- -->) is set, that's returned. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
expiryTime(now?: Date): number | undefined; | ||
``` | ||
|
||
## Parameters | ||
|
||
<table><thead><tr><th> | ||
|
||
Parameter | ||
|
||
|
||
</th><th> | ||
|
||
Type | ||
|
||
|
||
</th><th> | ||
|
||
Description | ||
|
||
|
||
</th></tr></thead> | ||
<tbody><tr><td> | ||
|
||
now | ||
|
||
|
||
</td><td> | ||
|
||
Date | ||
|
||
|
||
</td><td> | ||
|
||
_(Optional)_ can be used to provide a time offset (instead of [Cookie.lastAccessed](./tough-cookie.cookie.lastaccessed.md)<!-- -->) to use when calculating the "Max-Age" value | ||
|
||
|
||
</td></tr> | ||
</tbody></table> | ||
**Returns:** | ||
|
||
number \| undefined | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [extensions](./tough-cookie.cookie.extensions.md) | ||
|
||
## Cookie.extensions property | ||
|
||
Contains attributes which are not part of the defined spec but match the `extension-av` syntax defined in Section 4.1.1 of RFC6265 (See [RFC6265 Section 4.1.1](https://www.rfc-editor.org/rfc/rfc6265.html#section-4.1.1)<!-- -->). | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
extensions: string[] | null; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [fromJSON](./tough-cookie.cookie.fromjson.md) | ||
|
||
## Cookie.fromJSON() method | ||
|
||
Does the reverse of [Cookie.toJSON()](./tough-cookie.cookie.tojson.md)<!-- -->. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
static fromJSON(str: unknown): Cookie | undefined; | ||
``` | ||
|
||
## Parameters | ||
|
||
<table><thead><tr><th> | ||
|
||
Parameter | ||
|
||
|
||
</th><th> | ||
|
||
Type | ||
|
||
|
||
</th><th> | ||
|
||
Description | ||
|
||
|
||
</th></tr></thead> | ||
<tbody><tr><td> | ||
|
||
str | ||
|
||
|
||
</td><td> | ||
|
||
unknown | ||
|
||
|
||
</td><td> | ||
|
||
An unparsed JSON string or a value that has already been parsed as JSON | ||
|
||
|
||
</td></tr> | ||
</tbody></table> | ||
**Returns:** | ||
|
||
[Cookie](./tough-cookie.cookie.md) \| undefined | ||
|
||
## Remarks | ||
|
||
Any Date properties (such as .expires, .creation, and .lastAccessed) are parsed via Date.parse, not tough-cookie's parseDate, since ISO timestamps are being handled at this layer. | ||
|
||
## Example | ||
|
||
|
||
``` | ||
const json = JSON.stringify({ | ||
key: 'alpha', | ||
value: 'beta', | ||
domain: 'example.com', | ||
path: '/foo', | ||
expires: '2038-01-19T03:14:07.000Z', | ||
}) | ||
const cookie = Cookie.fromJSON(json) | ||
cookie.key === 'alpha' | ||
cookie.value === 'beta' | ||
cookie.domain === 'example.com' | ||
cookie.path === '/foo' | ||
cookie.expires === new Date(Date.parse('2038-01-19T03:14:07.000Z')) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [hostOnly](./tough-cookie.cookie.hostonly.md) | ||
|
||
## Cookie.hostOnly property | ||
|
||
A boolean flag indicating if a cookie is a host-only cookie (i.e.; when the request's host exactly matches the domain of the cookie) or not (See [RFC6265 Section 5.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.3)<!-- -->). | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
hostOnly: boolean | null; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [httpOnly](./tough-cookie.cookie.httponly.md) | ||
|
||
## Cookie.httpOnly property | ||
|
||
The 'HttpOnly' flag of the cookie indicates if the cookie is inaccessible to client scripts or not (See [RFC6265 Section 5.2.6](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2.6)<!-- -->). | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
httpOnly: boolean; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [tough-cookie](./tough-cookie.md) > [Cookie](./tough-cookie.cookie.md) > [isPersistent](./tough-cookie.cookie.ispersistent.md) | ||
|
||
## Cookie.isPersistent() method | ||
|
||
Indicates if the cookie has been persisted to a store or not. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
isPersistent(): boolean; | ||
``` | ||
**Returns:** | ||
|
||
boolean | ||
|
Oops, something went wrong.