@stryke/http 0.8.5 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.cjs +84 -0
- package/dist/agent.d.ts +36 -0
- package/dist/agent.mjs +2 -0
- package/dist/fetch.cjs +38 -0
- package/dist/fetch.d.ts +19 -0
- package/dist/fetch.mjs +1 -0
- package/dist/format-data-uri.cjs +24 -2
- package/dist/format-data-uri.d.ts +40 -0
- package/dist/format-data-uri.mjs +1 -1
- package/dist/get-free-port.cjs +15 -0
- package/dist/get-free-port.d.ts +6 -0
- package/dist/get-free-port.mjs +1 -0
- package/dist/http-proxy.cjs +71 -0
- package/dist/http-proxy.d.ts +39 -0
- package/dist/http-proxy.mjs +3 -0
- package/dist/https-proxy.cjs +88 -0
- package/dist/https-proxy.d.ts +43 -0
- package/dist/https-proxy.mjs +4 -0
- package/dist/index.cjs +63 -8
- package/dist/index.d.ts +7 -2
- package/dist/index.mjs +1 -1
- package/dist/parse-response.cjs +63 -0
- package/dist/parse-response.d.ts +12 -0
- package/dist/parse-response.mjs +4 -0
- package/dist/proxy-agent.cjs +14 -0
- package/dist/proxy-agent.d.ts +5 -0
- package/dist/proxy-agent.mjs +1 -0
- package/package.json +82 -18
- package/dist/cookie.cjs +0 -187
- package/dist/cookie.d.ts +0 -37
- package/dist/cookie.mjs +0 -1
- package/dist/types.cjs +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/types.mjs +0 -0
package/dist/types.d.ts
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cookie serialization options
|
|
3
|
-
*/
|
|
4
|
-
export interface CookieSerializeOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.3 | Domain Set-Cookie attribute}. By default, no
|
|
7
|
-
* domain is set, and most clients will consider the cookie to apply to only
|
|
8
|
-
* the current domain.
|
|
9
|
-
*/
|
|
10
|
-
domain?: string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Specifies a function that will be used to encode a cookie's value. Since
|
|
13
|
-
* value of a cookie has a limited character set (and must be a simple
|
|
14
|
-
* string), this function can be used to encode a value into a string suited
|
|
15
|
-
* for a cookie's value.
|
|
16
|
-
*
|
|
17
|
-
* The default function is the global `encodeURIComponent`, which will
|
|
18
|
-
* encode a JavaScript string into UTF-8 byte sequences and then URL-encode
|
|
19
|
-
* any that fall outside of the cookie range.
|
|
20
|
-
*/
|
|
21
|
-
encode?: (value: string) => string;
|
|
22
|
-
/**
|
|
23
|
-
* Specifies the `Date` object to be the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.1 | `Expires` `Set-Cookie` attribute}. By default,
|
|
24
|
-
* no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete
|
|
25
|
-
* it on a condition like exiting a web browser application.
|
|
26
|
-
*
|
|
27
|
-
* Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3 | cookie storage model specification}
|
|
28
|
-
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
|
|
29
|
-
* possible not all clients by obey this, so if both are set, they should
|
|
30
|
-
* point to the same date and time.
|
|
31
|
-
*/
|
|
32
|
-
expires?: Date | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.6 | `HttpOnly` `Set-Cookie` attribute}.
|
|
35
|
-
* When truthy, the `HttpOnly` attribute is set, otherwise it is not. By
|
|
36
|
-
* default, the `HttpOnly` attribute is not set.
|
|
37
|
-
*
|
|
38
|
-
* Note* be careful when setting this to true, as compliant clients will
|
|
39
|
-
* not allow client-side JavaScript to see the cookie in `document.cookie`.
|
|
40
|
-
*/
|
|
41
|
-
httpOnly?: boolean | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Specifies the number (in seconds) to be the value for the `Max-Age`
|
|
44
|
-
* `Set-Cookie` attribute. The given number will be converted to an integer
|
|
45
|
-
* by rounding down. By default, no maximum age is set.
|
|
46
|
-
*
|
|
47
|
-
* Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3 | cookie storage model specification}
|
|
48
|
-
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
|
|
49
|
-
* possible not all clients by obey this, so if both are set, they should
|
|
50
|
-
* point to the same date and time.
|
|
51
|
-
*/
|
|
52
|
-
maxAge?: number | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.4|`Path` `Set-Cookie` attribute}.
|
|
55
|
-
* By default, the path is considered the "default path".
|
|
56
|
-
*/
|
|
57
|
-
path?: string | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1].
|
|
60
|
-
*
|
|
61
|
-
* - `'low'` will set the `Priority` attribute to `Low`.
|
|
62
|
-
* - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
|
|
63
|
-
* - `'high'` will set the `Priority` attribute to `High`.
|
|
64
|
-
*
|
|
65
|
-
* More information about the different priority levels can be found in
|
|
66
|
-
* [the specification][rfc-west-cookie-priority-00-4.1].
|
|
67
|
-
*
|
|
68
|
-
* **note** This is an attribute that has not yet been fully standardized, and may change in the future.
|
|
69
|
-
* This also means many clients may ignore this attribute until they understand it.
|
|
70
|
-
*/
|
|
71
|
-
priority?: "low" | "medium" | "high" | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Specifies the boolean or string to be the value for the {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|`SameSite` `Set-Cookie` attribute}.
|
|
74
|
-
*
|
|
75
|
-
* - `true` will set the `SameSite` attribute to `Strict` for strict same
|
|
76
|
-
* site enforcement.
|
|
77
|
-
* - `false` will not set the `SameSite` attribute.
|
|
78
|
-
* - `'lax'` will set the `SameSite` attribute to Lax for lax same site
|
|
79
|
-
* enforcement.
|
|
80
|
-
* - `'strict'` will set the `SameSite` attribute to Strict for strict same
|
|
81
|
-
* site enforcement.
|
|
82
|
-
* - `'none'` will set the SameSite attribute to None for an explicit
|
|
83
|
-
* cross-site cookie.
|
|
84
|
-
*
|
|
85
|
-
* More information about the different enforcement levels can be found in {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|the specification}.
|
|
86
|
-
*
|
|
87
|
-
* note* This is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it.
|
|
88
|
-
*/
|
|
89
|
-
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
|
|
90
|
-
/**
|
|
91
|
-
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.5 | `Secure` `Set-Cookie` attribute}. When truthy, the
|
|
92
|
-
* `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
|
|
93
|
-
*
|
|
94
|
-
* Note* be careful when setting this to `true`, as compliant clients will
|
|
95
|
-
* not send the cookie back to the server in the future if the browser does
|
|
96
|
-
* not have an HTTPS connection.
|
|
97
|
-
*/
|
|
98
|
-
secure?: boolean | undefined;
|
|
99
|
-
/**
|
|
100
|
-
* Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1)
|
|
101
|
-
* attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the
|
|
102
|
-
* `Partitioned` attribute is not set.
|
|
103
|
-
*
|
|
104
|
-
* **note** This is an attribute that has not yet been fully standardized, and may change in the future.
|
|
105
|
-
* This also means many clients may ignore this attribute until they understand it.
|
|
106
|
-
*
|
|
107
|
-
* More information can be found in the [proposal](https://github.com/privacycg/CHIPS).
|
|
108
|
-
*/
|
|
109
|
-
partitioned?: boolean;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Additional parsing options
|
|
113
|
-
*/
|
|
114
|
-
export interface CookieParseOptions {
|
|
115
|
-
/**
|
|
116
|
-
* Specifies a function that will be used to decode a cookie's value. Since
|
|
117
|
-
* the value of a cookie has a limited character set (and must be a simple
|
|
118
|
-
* string), this function can be used to decode a previously-encoded cookie
|
|
119
|
-
* value into a JavaScript string or other object.
|
|
120
|
-
*
|
|
121
|
-
* The default function is the global `decodeURIComponent`, which will decode
|
|
122
|
-
* any URL-encoded sequences into their byte representations.
|
|
123
|
-
*
|
|
124
|
-
* Note* if an error is thrown from this function, the original, non-decoded
|
|
125
|
-
* cookie value will be returned as the cookie's value.
|
|
126
|
-
*/
|
|
127
|
-
decode?: (value: string) => string;
|
|
128
|
-
/**
|
|
129
|
-
* Custom function to filter parsing specific keys.
|
|
130
|
-
*/
|
|
131
|
-
filter?: (key: string) => boolean;
|
|
132
|
-
}
|
|
133
|
-
export interface SetCookieParseOptions {
|
|
134
|
-
/**
|
|
135
|
-
* Custom decode function to use on cookie values.
|
|
136
|
-
*
|
|
137
|
-
* By default, `decodeURIComponent` is used.
|
|
138
|
-
*
|
|
139
|
-
* **Note:** If decoding fails, the original (undecoded) value will be used
|
|
140
|
-
*/
|
|
141
|
-
decode?: false | ((value: string) => string);
|
|
142
|
-
}
|
|
143
|
-
export interface SetCookie {
|
|
144
|
-
/**
|
|
145
|
-
* Cookie name
|
|
146
|
-
*/
|
|
147
|
-
name: string;
|
|
148
|
-
/**
|
|
149
|
-
* Cookie value
|
|
150
|
-
*/
|
|
151
|
-
value: string;
|
|
152
|
-
/**
|
|
153
|
-
* Cookie path
|
|
154
|
-
*/
|
|
155
|
-
path?: string | undefined;
|
|
156
|
-
/**
|
|
157
|
-
* Absolute expiration date for the cookie
|
|
158
|
-
*/
|
|
159
|
-
expires?: Date | undefined;
|
|
160
|
-
/**
|
|
161
|
-
* Relative max age of the cookie in seconds from when the client receives it (integer or undefined)
|
|
162
|
-
*
|
|
163
|
-
* Note: when using with express's res.cookie() method, multiply maxAge by 1000 to convert to milliseconds
|
|
164
|
-
*/
|
|
165
|
-
maxAge?: number | undefined;
|
|
166
|
-
/**
|
|
167
|
-
* Domain for the cookie,
|
|
168
|
-
* May begin with "." to indicate the named domain or any subdomain of it
|
|
169
|
-
*/
|
|
170
|
-
domain?: string | undefined;
|
|
171
|
-
/**
|
|
172
|
-
* Indicates that this cookie should only be sent over HTTPs
|
|
173
|
-
*/
|
|
174
|
-
secure?: boolean | undefined;
|
|
175
|
-
/**
|
|
176
|
-
* Indicates that this cookie should not be accessible to client-side JavaScript
|
|
177
|
-
*/
|
|
178
|
-
httpOnly?: boolean | undefined;
|
|
179
|
-
/**
|
|
180
|
-
* Indicates a cookie ought not to be sent along with cross-site requests
|
|
181
|
-
*/
|
|
182
|
-
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
|
|
183
|
-
[key: string]: unknown;
|
|
184
|
-
}
|
package/dist/types.mjs
DELETED
|
File without changes
|