create-request 0.0.1-beta.18 → 0.0.1-beta.19

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.
Files changed (2) hide show
  1. package/README.md +13 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -143,6 +143,17 @@ const request = create
143
143
  // Authentication methods
144
144
  .withBearerToken("your-token") // Adds Authorization: Bearer your-token
145
145
  .withBasicAuth("username", "password") // HTTP Basic Authentication
146
+ .withAuthorization("auth-scheme value") // Custom authorization header
147
+
148
+ // Add a single cookie
149
+ .withCookie("language", "en-US")
150
+
151
+ // Add multiple cookies
152
+ .withCookies({
153
+ sessionId: "abc123",
154
+ preferences: { value: "dark-mode", secure: true },
155
+ tracking: { value: "enabled", sameSite: SameSitePolicy.STRICT },
156
+ })
146
157
 
147
158
  // URL parameters
148
159
  .withQueryParams({ search: "term", page: 1, limit: 20 })
@@ -157,7 +168,8 @@ const request = create
157
168
  .withRedirect(RedirectMode.FOLLOW) // Controls redirect behavior (follow, error, manual)
158
169
  .withReferrer("https://example.com") // Sets request referrer
159
170
  .withReferrerPolicy(ReferrerPolicy.NO_REFERRER_WHEN_DOWNGRADE) // Controls referrer policy
160
- .withPriority(RequestPriority.HIGH); // Sets request priority
171
+ .withPriority(RequestPriority.HIGH) // Sets request priority
172
+ .withKeepAlive(true); // Keeps connection alive after the page is unloaded
161
173
  ```
162
174
 
163
175
  Each configuration method returns the request object, allowing for a fluent interface where methods can be chained together. You can configure only what you need for a specific request:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-request",
3
- "version": "0.0.1-beta.18",
3
+ "version": "0.0.1-beta.19",
4
4
  "description": "A modern, chainable wrapper for fetch with automatic retries, timeouts, comprehensive error handling, and first-class TypeScript support",
5
5
  "main": "dist/library/index.js",
6
6
  "module": "dist/library/index.esm.js",