@@ -22,6 +22,7 @@ graphql-http
22
22
23
23
### Type Aliases
24
24
25
+ - [ AcceptableMediaType] ( README.md#acceptablemediatype )
25
26
- [ ExecutionContext] ( README.md#executioncontext )
26
27
- [ Handler] ( README.md#handler )
27
28
- [ Response] ( README.md#response )
@@ -32,7 +33,9 @@ graphql-http
32
33
33
34
- [ createClient] ( README.md#createclient )
34
35
- [ createHandler] ( README.md#createhandler )
36
+ - [ getAcceptableMediaType] ( README.md#getacceptablemediatype )
35
37
- [ isResponse] ( README.md#isresponse )
38
+ - [ makeResponse] ( README.md#makeresponse )
36
39
37
40
## Client
38
41
@@ -99,6 +102,14 @@ val is Response
99
102
100
103
## Server
101
104
105
+ ### AcceptableMediaType
106
+
107
+ Ƭ ** AcceptableMediaType** : `` "application/graphql+json" `` \| `` "application/json" ``
108
+
109
+ Request's Media-Type that the server accepts.
110
+
111
+ ___
112
+
102
113
### ExecutionContext
103
114
104
115
Ƭ ** ExecutionContext** : ` object ` \| ` symbol ` \| ` number ` \| ` string ` \| ` boolean ` \| ` undefined ` \| `` null ``
@@ -216,3 +227,47 @@ console.log('Listening to port 4000');
216
227
#### Returns
217
228
218
229
[ ` Handler ` ] ( README.md#handler ) <` RawRequest ` \>
230
+
231
+ ___
232
+
233
+ ### getAcceptableMediaType
234
+
235
+ ▸ ** getAcceptableMediaType** (` acceptHeader ` ): [ ` AcceptableMediaType ` ] ( README.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 Protocol.
239
+
240
+ #### Parameters
241
+
242
+ | Name | Type |
243
+ | :------ | :------ |
244
+ | ` acceptHeader ` | ` undefined ` \| `` null `` \| ` string ` |
245
+
246
+ #### Returns
247
+
248
+ [ ` AcceptableMediaType ` ] ( README.md#acceptablemediatype ) \| `` null ``
249
+
250
+ ___
251
+
252
+ ### makeResponse
253
+
254
+ ▸ ** makeResponse** (` resultOrErrors ` , ` acceptedMediaType ` ): [ ` Response ` ] ( README.md#response )
255
+
256
+ Creates an appropriate GraphQL over HTTP response following the provided arguments.
257
+
258
+ If the first argument is an ` ExecutionResult ` , the operation will be treated as "successful".
259
+
260
+ If the first argument is a ` GraphQLError ` (or an array of), the operation will be treated as invalid
261
+ and the response will be constructed with the help of ` acceptedMediaType ` complying with
262
+ the GraphQL over HTTP Protocol.
263
+
264
+ #### Parameters
265
+
266
+ | Name | Type |
267
+ | :------ | :------ |
268
+ | ` resultOrErrors ` | readonly ` GraphQLError ` [ ] \| ` Readonly ` <` ExecutionResult ` <` ObjMap ` <` unknown ` \> , ` ObjMap ` <` unknown ` \>\>\> \| ` Readonly ` <` GraphQLError ` \> |
269
+ | ` acceptedMediaType ` | [ ` AcceptableMediaType ` ] ( README.md#acceptablemediatype ) |
270
+
271
+ #### Returns
272
+
273
+ [ ` Response ` ] ( README.md#response )
0 commit comments