@@ -75,7 +75,7 @@ export function serverAudits(opts: ServerAuditOptions): Audit[] {
75
75
) ,
76
76
audit (
77
77
'47DE' ,
78
- 'SHOULD accept */* and use application/json for the content-type' ,
78
+ 'SHOULD accept */* and use application/graphql-response+json or application/ json for the content-type' ,
79
79
async ( ) => {
80
80
const res = await fetchFn ( await getUrl ( opts . url ) , {
81
81
method : 'POST' ,
@@ -86,12 +86,18 @@ export function serverAudits(opts: ServerAuditOptions): Audit[] {
86
86
body : JSON . stringify ( { query : '{ __typename }' } ) ,
87
87
} ) ;
88
88
ressert ( res ) . status . toBe ( 200 ) ;
89
- ressert ( res ) . header ( 'content-type' ) . toContain ( 'application/json' ) ;
89
+ try {
90
+ ressert ( res )
91
+ . header ( 'content-type' )
92
+ . toContain ( 'application/graphql-response+json' ) ;
93
+ } catch {
94
+ ressert ( res ) . header ( 'content-type' ) . toContain ( 'application/json' ) ;
95
+ }
90
96
} ,
91
97
) ,
92
98
audit (
93
99
'80D8' ,
94
- 'SHOULD assume application/json content-type when accept is missing' ,
100
+ 'SHOULD assume application/json or application/graphql-response+json content-type when accept is missing' ,
95
101
async ( ) => {
96
102
const res = await fetchFn ( await getUrl ( opts . url ) , {
97
103
method : 'POST' ,
@@ -102,7 +108,13 @@ export function serverAudits(opts: ServerAuditOptions): Audit[] {
102
108
} ) ;
103
109
104
110
ressert ( res ) . status . toBe ( 200 ) ;
105
- ressert ( res ) . header ( 'content-type' ) . toContain ( 'application/json' ) ;
111
+ try {
112
+ ressert ( res )
113
+ . header ( 'content-type' )
114
+ . toContain ( 'application/graphql-response+json' ) ;
115
+ } catch {
116
+ ressert ( res ) . header ( 'content-type' ) . toContain ( 'application/json' ) ;
117
+ }
106
118
} ,
107
119
) ,
108
120
audit ( '82A3' , 'MUST use utf-8 encoding when responding' , async ( ) => {
0 commit comments