@@ -40,16 +40,17 @@ Note that you can also add environment variables in the your configuration file
4040
4141# ## Configuration
4242
43- | Parameter | Description | Default |
44- | ----------------------- | ------------------------------------------------------ | -------------- |
45- | `metrics` | Whether to expose metrics at /metrics | `false` |
46- | `services[].name` | Name of the service. Can be anything. | Required `""` |
47- | `services[].url` | URL to send the request to | Required `""` |
48- | `services[].conditions` | Conditions used to determine the health of the service | `[]` |
49- | `services[].interval` | Duration to wait between every status check | `10s` |
50- | `services[].method` | Request method | `GET` |
51- | `services[].body` | Request body | `""` |
52- | `services[].headers` | Request headers | `{}` |
43+ | Parameter | Description | Default |
44+ | ----------------------- | --------------------------------------------------------------- | -------------- |
45+ | `metrics` | Whether to expose metrics at /metrics | `false` |
46+ | `services[].name` | Name of the service. Can be anything. | Required `""` |
47+ | `services[].url` | URL to send the request to | Required `""` |
48+ | `services[].conditions` | Conditions used to determine the health of the service | `[]` |
49+ | `services[].interval` | Duration to wait between every status check | `10s` |
50+ | `services[].method` | Request method | `GET` |
51+ | `services[].graphql` | Whether to wrap the body in a query param (`{"query":"$body"}`) | `false` |
52+ | `services[].body` | Request body | `""` |
53+ | `services[].headers` | Request headers | `{}` |
5354
5455
5556# ## Conditions
@@ -95,3 +96,38 @@ go test ./... -mod vendor
9596## Using in Production
9697
9798See the [example](example) folder.
99+
100+
101+ ## FAQ
102+
103+ ### Sending a GraphQL request
104+
105+ By setting `services[].graphql` to true, the body will automatically be wrapped by the standard GraphQL `query` parameter.
106+
107+ For instance, the following configuration:
108+ ```
109+ services:
110+ - name: properties
111+ url: http://localhost:8080/playground
112+ method: POST
113+ graphql: true
114+ body: |
115+ {
116+ user(gender: "female") {
117+ id
118+ name
119+ gender
120+ avatar
121+ }
122+ }
123+ headers:
124+ Content-Type: application/json
125+ conditions:
126+ - "[ STATUS] == 200"
127+ - "[ BODY] .data.user[ 0] .gender == female"
128+ ```
129+
130+ will send a `POST` request to `http://localhost:8080/playground` with the following body:
131+ ```json
132+ {"query":" {\n user(gender: \"female\") {\n id\n name\n gender\n avatar\n }\n }"}
133+ ```
0 commit comments