fetch-request-browser 1.0.10 → 1.0.11
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/README.md +28 -27
- package/dist/shared/errors.d.ts +1 -1
- package/package.json +13 -11
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ If you are working on a node-based environment, make use of [fetch-request-node]
|
|
|
12
12
|
|
|
13
13
|
Install the package:
|
|
14
14
|
```bash
|
|
15
|
-
npm
|
|
15
|
+
npm i -S fetch-request-browser
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
### Examples
|
|
@@ -125,6 +125,7 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
125
125
|
|
|
126
126
|
<details>
|
|
127
127
|
<summary><code>send</code></summary>
|
|
128
|
+
<br/>
|
|
128
129
|
|
|
129
130
|
Builds and sends an HTTP Request based on the provided input and options.
|
|
130
131
|
```typescript
|
|
@@ -161,10 +162,12 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
161
162
|
// }
|
|
162
163
|
// }
|
|
163
164
|
```
|
|
165
|
+
<br/>
|
|
164
166
|
</details>
|
|
165
167
|
|
|
166
168
|
<details>
|
|
167
169
|
<summary><code>sendGET</code></summary>
|
|
170
|
+
<br/>
|
|
168
171
|
|
|
169
172
|
Builds and sends a `GET` HTTP Request based on the provided input and options.
|
|
170
173
|
```typescript
|
|
@@ -197,10 +200,12 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
197
200
|
// }
|
|
198
201
|
// }
|
|
199
202
|
```
|
|
203
|
+
<br/>
|
|
200
204
|
</details>
|
|
201
205
|
|
|
202
206
|
<details>
|
|
203
207
|
<summary><code>sendPOST</code></summary>
|
|
208
|
+
<br/>
|
|
204
209
|
|
|
205
210
|
Builds and sends a `POST` HTTP Request based on the provided input and options.
|
|
206
211
|
```typescript
|
|
@@ -249,10 +254,12 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
249
254
|
// }
|
|
250
255
|
// }
|
|
251
256
|
```
|
|
257
|
+
<br/>
|
|
252
258
|
</details>
|
|
253
259
|
|
|
254
260
|
<details>
|
|
255
261
|
<summary><code>sendPUT</code></summary>
|
|
262
|
+
<br/>
|
|
256
263
|
|
|
257
264
|
Builds and sends a `PUT` HTTP Request based on the provided input and options.
|
|
258
265
|
```typescript
|
|
@@ -301,10 +308,12 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
301
308
|
// }
|
|
302
309
|
// }
|
|
303
310
|
```
|
|
311
|
+
<br/>
|
|
304
312
|
</details>
|
|
305
313
|
|
|
306
314
|
<details>
|
|
307
315
|
<summary><code>sendPATCH</code></summary>
|
|
316
|
+
<br/>
|
|
308
317
|
|
|
309
318
|
Builds and sends a `PATCH` HTTP Request based on the provided input and options.
|
|
310
319
|
```typescript
|
|
@@ -353,10 +362,12 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
353
362
|
// }
|
|
354
363
|
// }
|
|
355
364
|
```
|
|
365
|
+
<br/>
|
|
356
366
|
</details>
|
|
357
367
|
|
|
358
368
|
<details>
|
|
359
369
|
<summary><code>sendDELETE</code></summary>
|
|
370
|
+
<br/>
|
|
360
371
|
|
|
361
372
|
Builds and sends a `DELETE` HTTP Request based on the provided input and options.
|
|
362
373
|
```typescript
|
|
@@ -394,6 +405,7 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
394
405
|
// }
|
|
395
406
|
// }
|
|
396
407
|
```
|
|
408
|
+
<br/>
|
|
397
409
|
</details>
|
|
398
410
|
|
|
399
411
|
|
|
@@ -407,24 +419,29 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
407
419
|
|
|
408
420
|
<details>
|
|
409
421
|
<summary><code>IRequestInput</code></summary>
|
|
422
|
+
<br/>
|
|
410
423
|
|
|
411
424
|
The URL of the request's target.
|
|
412
425
|
```typescript
|
|
413
426
|
type IRequestInput = string | URL;
|
|
414
427
|
```
|
|
428
|
+
<br/>
|
|
415
429
|
</details>
|
|
416
430
|
|
|
417
431
|
<details>
|
|
418
432
|
<summary><code>IRequestMethod</code></summary>
|
|
433
|
+
<br/>
|
|
419
434
|
|
|
420
435
|
The HTTP Methods supported by this library. To make use of a different one, pass the method name directly in the request options.
|
|
421
436
|
```typescript
|
|
422
437
|
type IRequestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
423
438
|
```
|
|
439
|
+
<br/>
|
|
424
440
|
</details>
|
|
425
441
|
|
|
426
442
|
<details>
|
|
427
443
|
<summary><code>RequestInit</code></summary>
|
|
444
|
+
<br/>
|
|
428
445
|
|
|
429
446
|
The [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit) dictionary of the Fetch API represents the set of options that can be used to configure a fetch request.
|
|
430
447
|
```typescript
|
|
@@ -458,10 +475,12 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
458
475
|
window?: null;
|
|
459
476
|
}
|
|
460
477
|
```
|
|
478
|
+
<br/>
|
|
461
479
|
</details>
|
|
462
480
|
|
|
463
481
|
<details>
|
|
464
482
|
<summary><code>IRequestOptions</code></summary>
|
|
483
|
+
<br/>
|
|
465
484
|
|
|
466
485
|
The options that can be applied when sending a Fetch Request.
|
|
467
486
|
IMPORTANT: the reason RequestInit is extended is because in the original type, the body property does not accept plain objects. Even though this makes sense, utilities so the Request's body is always going to have a valid type.
|
|
@@ -475,19 +494,23 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
475
494
|
method: IRequestMethod;
|
|
476
495
|
}
|
|
477
496
|
```
|
|
497
|
+
<br/>
|
|
478
498
|
</details>
|
|
479
499
|
|
|
480
500
|
<details>
|
|
481
501
|
<summary><code>IResponseDataType</code></summary>
|
|
502
|
+
<br/>
|
|
482
503
|
|
|
483
504
|
The type of data that will be extracted from the HTTP Response body.
|
|
484
505
|
```typescript
|
|
485
506
|
type IResponseDataType = 'arrayBuffer' | 'blob' | 'formData' | 'json' | 'text';
|
|
486
507
|
```
|
|
508
|
+
<br/>
|
|
487
509
|
</details>
|
|
488
510
|
|
|
489
511
|
<details>
|
|
490
512
|
<summary><code>IOptions</code></summary>
|
|
513
|
+
<br/>
|
|
491
514
|
|
|
492
515
|
The options object that can be passed and used for any request.
|
|
493
516
|
```typescript
|
|
@@ -515,10 +538,12 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
515
538
|
skipStatusCodeValidation: boolean;
|
|
516
539
|
}
|
|
517
540
|
```
|
|
541
|
+
<br/>
|
|
518
542
|
</details>
|
|
519
543
|
|
|
520
544
|
<details>
|
|
521
545
|
<summary><code>IRequestResponse<T></code></summary>
|
|
546
|
+
<br/>
|
|
522
547
|
|
|
523
548
|
The object containing the result of the Request.
|
|
524
549
|
```typescript
|
|
@@ -536,6 +561,7 @@ await sendPOST<IHTTPBinResponse>(
|
|
|
536
561
|
data: T;
|
|
537
562
|
}
|
|
538
563
|
```
|
|
564
|
+
<br/>
|
|
539
565
|
</details>
|
|
540
566
|
|
|
541
567
|
|
|
@@ -571,29 +597,4 @@ npm run test:integration
|
|
|
571
597
|
|
|
572
598
|
## License
|
|
573
599
|
|
|
574
|
-
[MIT](https://choosealicense.com/licenses/mit/)
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
<br />
|
|
581
|
-
|
|
582
|
-
## Deployment
|
|
583
|
-
|
|
584
|
-
Install dependencies:
|
|
585
|
-
```bash
|
|
586
|
-
npm install
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
Build the library:
|
|
591
|
-
```bash
|
|
592
|
-
npm start
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
Publish to `npm`:
|
|
597
|
-
```bash
|
|
598
|
-
npm publish
|
|
599
|
-
```
|
|
600
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
package/dist/shared/errors.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fetch-request-browser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "The fetch-request-browser package makes working with external APIs simple and efficient. This intuitive wrapper leverages the power of the Fetch API, providing a clean and concise interface for your API interactions.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"
|
|
9
|
+
"build": "ts-lib-builder --tsconfig=tsconfig.build.json",
|
|
10
10
|
"test": "echo \"Error: tests are executed with npm run test:(integration|unit)\" && exit 1",
|
|
11
11
|
"test:integration": "vitest run --config vitest.test-integration.config.ts",
|
|
12
12
|
"test:unit": "vitest run --config vitest.test-unit.config.ts",
|
|
@@ -33,16 +33,18 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/jesusgraterol/fetch-request-browser#readme",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "
|
|
38
|
-
"@typescript-eslint/parser": "
|
|
39
|
-
"eslint-config-airbnb-typescript": "
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
36
|
+
"@types/node": "20.17.17",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "7.18.0",
|
|
38
|
+
"@typescript-eslint/parser": "7.18.0",
|
|
39
|
+
"eslint-config-airbnb-typescript": "18.0.0",
|
|
40
|
+
"eslint-config-prettier": "10.1.8",
|
|
41
|
+
"prettier": "3.6.2",
|
|
42
|
+
"ts-lib-builder": "1.0.7",
|
|
43
|
+
"typescript": "5.7.3",
|
|
44
|
+
"vitest": "3.2.4"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
|
-
"error-message-utils": "
|
|
46
|
-
"web-utils-kit": "
|
|
47
|
+
"error-message-utils": "1.1.5",
|
|
48
|
+
"web-utils-kit": "1.0.6"
|
|
47
49
|
}
|
|
48
50
|
}
|