@@ -491,24 +491,69 @@ export function serverAudits(opts: ServerAuditOptions): Audit[] {
491
491
await ressert ( res ) . bodyAsExecutionResult . notToHaveProperty ( 'errors' ) ;
492
492
} ,
493
493
) ,
494
+ ...[ 'string' , 0 , false , [ 'array' ] ] . map ( ( invalid , index ) =>
495
+ audit (
496
+ `028${ index } ` ,
497
+ `MUST use 4xx or 5xx status codes on ${ extendedTypeof (
498
+ invalid ,
499
+ ) } {extensions} parameter when accepting application/graphql-response+json`,
500
+ async ( ) => {
501
+ const res = await fetchFn ( await getUrl ( opts . url ) , {
502
+ method : 'POST' ,
503
+ headers : {
504
+ 'content-type' : 'application/json' ,
505
+ accept : 'application/graphql-response+json' ,
506
+ } ,
507
+ body : JSON . stringify ( {
508
+ query : '{ __typename }' ,
509
+ extensions : invalid ,
510
+ } ) ,
511
+ } ) ;
512
+ ressert ( res ) . status . toBeBetween ( 400 , 599 ) ;
513
+ } ,
514
+ ) ,
515
+ ) ,
516
+ ...[ 'string' , 0 , false , [ 'array' ] ] . map ( ( invalid , index ) =>
517
+ audit (
518
+ `233${ index } ` ,
519
+ `SHOULD use 4xx status code on ${ extendedTypeof (
520
+ invalid ,
521
+ ) } {extensions} parameter when accepting application/graphql-response+json`,
522
+ async ( ) => {
523
+ const res = await fetchFn ( await getUrl ( opts . url ) , {
524
+ method : 'POST' ,
525
+ headers : {
526
+ 'content-type' : 'application/json' ,
527
+ accept : 'application/graphql-response+json' ,
528
+ } ,
529
+ body : JSON . stringify ( {
530
+ query : '{ __typename }' ,
531
+ extensions : invalid ,
532
+ } ) ,
533
+ } ) ;
534
+ ressert ( res ) . status . toBeBetween ( 400 , 499 ) ;
535
+ } ,
536
+ ) ,
537
+ ) ,
494
538
...[ 'string' , 0 , false , [ 'array' ] ] . map ( ( invalid , index ) =>
495
539
audit (
496
540
`58B${ index } ` ,
497
- `MUST use 400 status code on ${ extendedTypeof (
541
+ `SHOULD use 4xx or 5xx status codes on ${ extendedTypeof (
498
542
invalid ,
499
- ) } {extensions} parameter`,
543
+ ) } {extensions} parameter when accepting application/json `,
500
544
async ( ) => {
501
545
const res = await fetchFn ( await getUrl ( opts . url ) , {
502
546
method : 'POST' ,
503
547
headers : {
504
548
'content-type' : 'application/json' ,
549
+ accept : 'application/json' ,
505
550
} ,
506
551
body : JSON . stringify ( {
507
552
query : '{ __typename }' ,
508
553
extensions : invalid ,
509
554
} ) ,
510
555
} ) ;
511
- ressert ( res ) . status . toBe ( 400 ) ;
556
+ ressert ( res ) . status . toBeBetween ( 400 , 599 ) ;
512
557
} ,
513
558
) ,
514
559
) ,
0 commit comments