-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRequest.ts
67 lines (58 loc) · 1.48 KB
/
Request.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* @since 1.0.0
*/
import type { Effect } from "effect/Effect";
import { DecodeError } from "./internal/error.js";
import * as internal from "./internal/request.js";
import { Body } from "./internal/body.js";
import { HttpRequest } from "./internal/request.js";
/**
* @since 1.0.0
* @category constructors
*/
export const make: (url: string | URL, init?: RequestInit) => HttpRequest = internal.make
/**
* @since 1.0.0
* @category mapping
*/
export const map: {
<B>(fn: (request: HttpRequest) => B): (request: HttpRequest) => B;
<B>(request: HttpRequest, fn: (request: HttpRequest) => B): B;
} = internal.map;
/**
* @since 1.0.0
* @category mapping
*/
export const appendBody: (body: Body) => (request: HttpRequest) => Request = internal.appendBody
/**
* @since 1.0.0
* @category combinators
*/
export const json: (value: Request) => Effect<any, DecodeError, never> =
internal.json;
/**
* @since 1.0.0
* @category combinators
*/
export const text: (value: Request) => Effect<string, DecodeError, never> =
internal.text;
/**
* @since 1.0.0
* @category combinators
*/
export const blob: (value: Request) => Effect<Blob, DecodeError, never> =
internal.blob;
/**
* @since 1.0.0
* @category combinators
*/
export const formData: (
value: Request
) => Effect<FormData, DecodeError, never> = internal.formData;
/**
* @since 1.0.0
* @category combinators
*/
export const arrayBuffer: (
value: Request
) => Effect<ArrayBuffer, DecodeError, never> = internal.arrayBuffer;