12
12
13
13
### Type Aliases
14
14
15
- - [ AcceptableMediaType] ( handler.md#acceptablemediatype )
16
15
- [ FormatError] ( handler.md#formaterror )
17
16
- [ Handler] ( handler.md#handler )
18
17
- [ OperationArgs] ( handler.md#operationargs )
25
24
### Functions
26
25
27
26
- [ createHandler] ( handler.md#createhandler )
28
- - [ getAcceptableMediaType] ( handler.md#getacceptablemediatype )
29
27
- [ isResponse] ( handler.md#isresponse )
30
- - [ makeResponse] ( handler.md#makeresponse )
31
28
32
29
## Server
33
30
34
- ### AcceptableMediaType
35
-
36
- Ƭ ** AcceptableMediaType** : `` "application/graphql-response+json" `` \| `` "application/json" ``
37
-
38
- Request's Media-Type that the server accepts.
39
-
40
- ___
41
-
42
31
### FormatError
43
32
44
33
Ƭ ** FormatError** : (` err ` : ` Readonly ` <` GraphQLError ` \| ` Error ` \> ) => ` GraphQLError ` \| ` Error `
@@ -230,25 +219,6 @@ console.log('Listening to port 4000');
230
219
231
220
___
232
221
233
- ### getAcceptableMediaType
234
-
235
- ▸ ** getAcceptableMediaType** (` acceptHeader ` ): [ ` AcceptableMediaType ` ] ( handler.md#acceptablemediatype ) \| `` null ``
236
-
237
- Inspects the request and detects the appropriate/acceptable Media-Type
238
- looking at the ` Accept ` header while complying with the GraphQL over HTTP spec.
239
-
240
- #### Parameters
241
-
242
- | Name | Type |
243
- | :------ | :------ |
244
- | ` acceptHeader ` | ` undefined ` \| `` null `` \| ` string ` |
245
-
246
- #### Returns
247
-
248
- [ ` AcceptableMediaType ` ] ( handler.md#acceptablemediatype ) \| `` null ``
249
-
250
- ___
251
-
252
222
### isResponse
253
223
254
224
▸ ** isResponse** (` val ` ): val is Response
@@ -264,31 +234,3 @@ Checks whether the passed value is the `graphql-http` server agnostic response.
264
234
#### Returns
265
235
266
236
val is Response
267
-
268
- ___
269
-
270
- ### makeResponse
271
-
272
- ▸ ** makeResponse** (` resultOrErrors ` , ` acceptedMediaType ` , ` formatError ` ): [ ` Response ` ] ( handler.md#response )
273
-
274
- Creates an appropriate GraphQL over HTTP response following the provided arguments.
275
-
276
- If the first argument is an ` ExecutionResult ` , the operation will be treated as "successful".
277
-
278
- If the first argument is (an array of) ` GraphQLError ` , or an ` ExecutionResult ` without the ` data ` field, it will be treated
279
- the response will be constructed with the help of ` acceptedMediaType ` complying with the GraphQL over HTTP spec.
280
-
281
- If the first argument is an ` Error ` , the operation will be treated as a bad request responding with ` 400: Bad Request ` and the
282
- error will be present in the ` ExecutionResult ` style.
283
-
284
- #### Parameters
285
-
286
- | Name | Type |
287
- | :------ | :------ |
288
- | ` resultOrErrors ` | readonly ` GraphQLError ` [ ] \| ` Readonly ` <` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\>\> \| ` Readonly ` <` GraphQLError ` \> \| ` Readonly ` <` Error ` \> |
289
- | ` acceptedMediaType ` | [ ` AcceptableMediaType ` ] ( handler.md#acceptablemediatype ) |
290
- | ` formatError ` | [ ` FormatError ` ] ( handler.md#formaterror ) |
291
-
292
- #### Returns
293
-
294
- [ ` Response ` ] ( handler.md#response )
0 commit comments