@@ -10,18 +10,18 @@ beforeAll(() => {
10
10
} ) ;
11
11
12
12
describe ( 'Media Types' , ( ) => {
13
- it ( 'must accept application/graphql+json and match the content-type' , async ( ) => {
13
+ it ( 'must accept application/graphql-response +json and match the content-type' , async ( ) => {
14
14
const url = new URL ( serverUrl ) ;
15
15
url . searchParams . set ( 'query' , '{ __typename }' ) ;
16
16
17
17
const res = await fetch ( url . toString ( ) , {
18
18
headers : {
19
- accept : 'application/graphql+json' ,
19
+ accept : 'application/graphql-response +json' ,
20
20
} ,
21
21
} ) ;
22
22
expect ( res . status ) . toBe ( 200 ) ;
23
23
expect ( res . headers . get ( 'content-type' ) ) . toContain (
24
- 'application/graphql+json' ,
24
+ 'application/graphql-response +json' ,
25
25
) ;
26
26
} ) ;
27
27
@@ -38,7 +38,7 @@ describe('Media Types', () => {
38
38
expect ( res . headers . get ( 'content-type' ) ) . toContain ( 'application/json' ) ;
39
39
} ) ;
40
40
41
- it ( 'must accept */* and use application/graphql+json for the content-type' , async ( ) => {
41
+ it ( 'must accept */* and use application/graphql-response +json for the content-type' , async ( ) => {
42
42
const url = new URL ( serverUrl ) ;
43
43
url . searchParams . set ( 'query' , '{ __typename }' ) ;
44
44
@@ -49,18 +49,18 @@ describe('Media Types', () => {
49
49
} ) ;
50
50
expect ( res . status ) . toBe ( 200 ) ;
51
51
expect ( res . headers . get ( 'content-type' ) ) . toContain (
52
- 'application/graphql+json' ,
52
+ 'application/graphql-response +json' ,
53
53
) ;
54
54
} ) ;
55
55
56
- it ( 'must assume application/graphql+json content-type when accept is missing' , async ( ) => {
56
+ it ( 'must assume application/graphql-response +json content-type when accept is missing' , async ( ) => {
57
57
const url = new URL ( serverUrl ) ;
58
58
url . searchParams . set ( 'query' , '{ __typename }' ) ;
59
59
60
60
const res = await fetch ( url . toString ( ) ) ;
61
61
expect ( res . status ) . toBe ( 200 ) ;
62
62
expect ( res . headers . get ( 'content-type' ) ) . toContain (
63
- 'application/graphql+json' ,
63
+ 'application/graphql-response +json' ,
64
64
) ;
65
65
} ) ;
66
66
@@ -79,7 +79,7 @@ describe('Media Types', () => {
79
79
80
80
const res = await fetch ( url . toString ( ) , {
81
81
headers : {
82
- accept : 'application/graphql+json; charset=iso-8859-1' ,
82
+ accept : 'application/graphql-response +json; charset=iso-8859-1' ,
83
83
} ,
84
84
} ) ;
85
85
expect ( res . status ) . toBe ( 406 ) ;
@@ -112,7 +112,7 @@ describe('Request', () => {
112
112
113
113
const res = await fetch ( url . toString ( ) , {
114
114
headers : {
115
- accept : 'application/graphql+json' ,
115
+ accept : 'application/graphql-response +json' ,
116
116
} ,
117
117
} ) ;
118
118
expect ( res . status ) . toBe ( 405 ) ;
@@ -152,7 +152,7 @@ describe('Request', () => {
152
152
method : 'POST' ,
153
153
headers : {
154
154
'content-type' : 'application/json' ,
155
- accept : 'application/graphql+json' ,
155
+ accept : 'application/graphql-response +json' ,
156
156
} ,
157
157
body : JSON . stringify ( { notquery : '{ __typename }' } ) ,
158
158
} ) ;
@@ -165,7 +165,7 @@ describe('Request', () => {
165
165
method : 'POST' ,
166
166
headers : {
167
167
'content-type' : 'application/json' ,
168
- accept : 'application/graphql+json' ,
168
+ accept : 'application/graphql-response +json' ,
169
169
} ,
170
170
body : JSON . stringify ( {
171
171
query : invalid ,
@@ -179,7 +179,7 @@ describe('Request', () => {
179
179
method : 'POST' ,
180
180
headers : {
181
181
'content-type' : 'application/json' ,
182
- accept : 'application/graphql+json' ,
182
+ accept : 'application/graphql-response +json' ,
183
183
} ,
184
184
body : JSON . stringify ( {
185
185
query : '{ __typename }' ,
@@ -195,7 +195,7 @@ describe('Request', () => {
195
195
method : 'POST' ,
196
196
headers : {
197
197
'content-type' : 'application/json' ,
198
- accept : 'application/graphql+json' ,
198
+ accept : 'application/graphql-response +json' ,
199
199
} ,
200
200
body : JSON . stringify ( {
201
201
operationName : invalid ,
@@ -210,7 +210,7 @@ describe('Request', () => {
210
210
method : 'POST' ,
211
211
headers : {
212
212
'content-type' : 'application/json' ,
213
- accept : 'application/graphql+json' ,
213
+ accept : 'application/graphql-response +json' ,
214
214
} ,
215
215
body : JSON . stringify ( {
216
216
operationName : 'Query' ,
@@ -227,7 +227,7 @@ describe('Request', () => {
227
227
method : 'POST' ,
228
228
headers : {
229
229
'content-type' : 'application/json' ,
230
- accept : 'application/graphql+json' ,
230
+ accept : 'application/graphql-response +json' ,
231
231
} ,
232
232
body : JSON . stringify ( {
233
233
query : '{ __typename }' ,
@@ -242,7 +242,7 @@ describe('Request', () => {
242
242
method : 'POST' ,
243
243
headers : {
244
244
'content-type' : 'application/json' ,
245
- accept : 'application/graphql+json' ,
245
+ accept : 'application/graphql-response +json' ,
246
246
} ,
247
247
body : JSON . stringify ( {
248
248
query : 'query Type($name: String!) { __type(name: $name) { name } }' ,
@@ -275,7 +275,7 @@ describe('Request', () => {
275
275
method : 'POST' ,
276
276
headers : {
277
277
'content-type' : 'application/json' ,
278
- accept : 'application/graphql+json' ,
278
+ accept : 'application/graphql-response +json' ,
279
279
} ,
280
280
body : JSON . stringify ( {
281
281
query : '{ __typename }' ,
@@ -290,7 +290,7 @@ describe('Request', () => {
290
290
method : 'POST' ,
291
291
headers : {
292
292
'content-type' : 'application/json' ,
293
- accept : 'application/graphql+json' ,
293
+ accept : 'application/graphql-response +json' ,
294
294
} ,
295
295
body : JSON . stringify ( {
296
296
query : '{ __typename }' ,
@@ -350,13 +350,13 @@ describe('Response', () => {
350
350
} ) ;
351
351
} ) ;
352
352
353
- describe ( 'application/graphql+json' , ( ) => {
353
+ describe ( 'application/graphql-response +json' , ( ) => {
354
354
it ( 'must use 4xx or 5xx status codes on JSON parsing failure' , async ( ) => {
355
355
const res = await fetch ( serverUrl , {
356
356
method : 'POST' ,
357
357
headers : {
358
358
'content-type' : 'application/json' ,
359
- accept : 'application/graphql+json' ,
359
+ accept : 'application/graphql-response +json' ,
360
360
} ,
361
361
body : '{ "not a JSON' ,
362
362
} ) ;
@@ -368,7 +368,7 @@ describe('Response', () => {
368
368
method : 'POST' ,
369
369
headers : {
370
370
'content-type' : 'application/json' ,
371
- accept : 'application/graphql+json' ,
371
+ accept : 'application/graphql-response +json' ,
372
372
} ,
373
373
body : '{ "not a JSON' ,
374
374
} ) ;
@@ -380,7 +380,7 @@ describe('Response', () => {
380
380
url . searchParams . set ( 'qeury' /* typo */ , '{ __typename }' ) ;
381
381
const res = await fetch ( url . toString ( ) , {
382
382
method : 'GET' ,
383
- headers : { accept : 'application/graphql+json' } ,
383
+ headers : { accept : 'application/graphql-response +json' } ,
384
384
} ) ;
385
385
expect ( res . status ) . toBeGreaterThanOrEqual ( 400 ) ;
386
386
expect ( res . status ) . toBeLessThanOrEqual ( 599 ) ;
@@ -390,7 +390,7 @@ describe('Response', () => {
390
390
url . searchParams . set ( 'qeury' /* typo */ , '{ __typename }' ) ;
391
391
const res = await fetch ( url . toString ( ) , {
392
392
method : 'GET' ,
393
- headers : { accept : 'application/graphql+json' } ,
393
+ headers : { accept : 'application/graphql-response +json' } ,
394
394
} ) ;
395
395
expect ( res . status ) . toBe ( 400 ) ;
396
396
} ) ;
@@ -400,7 +400,7 @@ describe('Response', () => {
400
400
url . searchParams . set ( 'query' , '{' ) ;
401
401
const res = await fetch ( url . toString ( ) , {
402
402
method : 'GET' ,
403
- headers : { accept : 'application/graphql+json' } ,
403
+ headers : { accept : 'application/graphql-response +json' } ,
404
404
} ) ;
405
405
expect ( res . status ) . toBeGreaterThanOrEqual ( 400 ) ;
406
406
expect ( res . status ) . toBeLessThanOrEqual ( 599 ) ;
@@ -410,7 +410,7 @@ describe('Response', () => {
410
410
url . searchParams . set ( 'query' , '{' ) ;
411
411
const res = await fetch ( url . toString ( ) , {
412
412
method : 'GET' ,
413
- headers : { accept : 'application/graphql+json' } ,
413
+ headers : { accept : 'application/graphql-response +json' } ,
414
414
} ) ;
415
415
expect ( res . status ) . toBe ( 400 ) ;
416
416
} ) ;
@@ -420,7 +420,7 @@ describe('Response', () => {
420
420
url . searchParams . set ( 'query' , '{ 8f31403dfe404bccbb0e835f2629c6a7 }' ) ; // making sure the field doesnt exist
421
421
const res = await fetch ( url . toString ( ) , {
422
422
method : 'GET' ,
423
- headers : { accept : 'application/graphql+json' } ,
423
+ headers : { accept : 'application/graphql-response +json' } ,
424
424
} ) ;
425
425
expect ( res . status ) . toBeGreaterThanOrEqual ( 400 ) ;
426
426
expect ( res . status ) . toBeLessThanOrEqual ( 599 ) ;
@@ -430,7 +430,7 @@ describe('Response', () => {
430
430
url . searchParams . set ( 'query' , '{ 8f31403dfe404bccbb0e835f2629c6a7 }' ) ; // making sure the field doesnt exist
431
431
const res = await fetch ( url . toString ( ) , {
432
432
method : 'GET' ,
433
- headers : { accept : 'application/graphql+json' } ,
433
+ headers : { accept : 'application/graphql-response +json' } ,
434
434
} ) ;
435
435
expect ( res . status ) . toBe ( 400 ) ;
436
436
} ) ;
0 commit comments