@@ -509,4 +509,64 @@ describe('octokitRequest()', () => {
509509 expect ( result . data ) . to . equal ( 'funk' )
510510 } )
511511 } )
512+
513+ it ( 'options.mediaType.format' , function ( ) {
514+ const mock = fetchMock . sandbox ( )
515+ . mock ( 'https://api.github.com/repos/octokit/request.js/issues/1' , 'ok' , {
516+ headers : {
517+ accept : 'application/vnd.github.v3.raw+json' ,
518+ authorization : 'token 0000000000000000000000000000000000000001' ,
519+ 'user-agent' : userAgent
520+ }
521+ } )
522+
523+ return octokitRequest ( 'GET /repos/:owner/:repo/issues/:number' , {
524+ headers : {
525+ authorization : 'token 0000000000000000000000000000000000000001'
526+ } ,
527+ mediaType : {
528+ format : 'raw+json'
529+ } ,
530+ owner : 'octokit' ,
531+ repo : 'request.js' ,
532+ number : 1 ,
533+ request : {
534+ fetch : mock
535+ }
536+ } )
537+
538+ . then ( response => {
539+ expect ( response . data ) . to . equal ( 'ok' )
540+ } )
541+ } )
542+
543+ it ( 'options.mediaType.previews' , function ( ) {
544+ const mock = fetchMock . sandbox ( )
545+ . mock ( 'https://api.github.com/repos/octokit/request.js/issues/1' , 'ok' , {
546+ headers : {
547+ accept : 'application/vnd.foo-preview+json,application/vnd.bar-preview+json' ,
548+ authorization : 'token 0000000000000000000000000000000000000001' ,
549+ 'user-agent' : userAgent
550+ }
551+ } )
552+
553+ return octokitRequest ( 'GET /repos/:owner/:repo/issues/:number' , {
554+ headers : {
555+ authorization : 'token 0000000000000000000000000000000000000001'
556+ } ,
557+ mediaType : {
558+ previews : [ 'foo' , 'bar' ]
559+ } ,
560+ owner : 'octokit' ,
561+ repo : 'request.js' ,
562+ number : 1 ,
563+ request : {
564+ fetch : mock
565+ }
566+ } )
567+
568+ . then ( response => {
569+ expect ( response . data ) . to . equal ( 'ok' )
570+ } )
571+ } )
512572} )
0 commit comments