1 | /// <reference types="node" />
|
2 | export declare type HttpHeaders = Record<string, string>;
|
3 | /**
|
4 | * RequestOptions is a set of properties that define
|
5 | * a request, or state change.
|
6 | *
|
7 | * Everything is usually optional.
|
8 | */
|
9 | export declare type RequestOptions<T = any> = {
|
10 | /**
|
11 | * Should return a string or a Buffer.
|
12 | *
|
13 | * Will be used as the body in the HTTP request.
|
14 | * If not set, `body` will be used instead.
|
15 | */
|
16 | serializeBody?: () => string | Buffer | Blob;
|
17 | /**
|
18 | * If set, contains the body of the current state.
|
19 | *
|
20 | * If body is not a `string` or a `Buffer`, the body will
|
21 | * be json encoded.
|
22 | */
|
23 | data?: T;
|
24 | /**
|
25 | * List of headers that will be set in the request.
|
26 | *
|
27 | * If this is not set, we'll fall back to 'headers'
|
28 | */
|
29 | getContentHeaders?: () => HttpHeaders | Headers;
|
30 | /**
|
31 | * Full list of HTTP headers.
|
32 | */
|
33 | headers?: HttpHeaders | Headers;
|
34 | };
|
35 | export declare type GetRequestOptions = Omit<RequestOptions, 'serializeBody' | 'data'>;
|
36 | export declare type HeadRequestOptions = GetRequestOptions;
|
37 | export declare type PatchRequestOptions<T = any> = RequestOptions<T>;
|
38 | export declare type PutRequestOptions<T = any> = RequestOptions<T>;
|
39 | export declare type PostRequestOptions<T = any> = RequestOptions<T>;
|