-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathapi-request.ts
More file actions
87 lines (73 loc) · 2.16 KB
/
Copy pathapi-request.ts
File metadata and controls
87 lines (73 loc) · 2.16 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { Assertion } from './api-assertion.js'
import { HttpHeader } from './http-header.js'
import { HttpRequestMethod } from './http-request.js'
import { IPFamily } from './ip.js'
import { QueryParam } from './query-param.js'
/** HTTP request body types supported by API checks */
export type BodyType = 'JSON' | 'FORM' | 'RAW' | 'GRAPHQL' | 'NONE'
/**
* Basic authentication credentials for HTTP requests.
*/
export interface BasicAuth {
/** Username for basic authentication */
username: string
/** Password for basic authentication */
password: string
}
/**
* Configuration for an HTTP request in an API check.
* Defines all aspects of the HTTP request to be made.
*/
// Called Request instead of HttpRequest for historical reasons.
export interface Request {
/**
* The URL to make the request to.
* @maxLength 2048
* @example 'https://api.example.com/users'
*/
url: string
/**
* The HTTP method to use.
* Supported methods: GET, POST, PUT, HEAD, DELETE, PATCH
*/
method: HttpRequestMethod
/**
* IP family version to use for network requests.
* @defaultValue 'IPv4'
*/
ipFamily?: IPFamily
/**
* Whether to follow HTTP redirects automatically.
* @defaultValue true
*/
followRedirects?: boolean
/**
* Whether to skip SSL certificate verification.
* @defaultValue false
*/
skipSSL?: boolean
/**
* Whether to treat the response body as text even when the response Content-Type is marked as binary.
* @defaultValue false
*/
treatResponseBodyAsText?: boolean
/**
* Assertions to validate the HTTP response.
* Check the main Checkly documentation on assertions for specific values like regular expressions
* and JSON path descriptors you can use in the "property" field.
*/
assertions?: Array<Assertion>
/** The request body content */
body?: string
/**
* The type of the request body.
* @defaultValue 'NONE'
*/
bodyType?: BodyType
/** HTTP headers to include in the request */
headers?: Array<HttpHeader>
/** Query parameters to include in the request URL */
queryParameters?: Array<QueryParam>
/** Basic authentication credentials */
basicAuth?: BasicAuth
}