File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -58,32 +58,23 @@ export const getOpenAPISourceFile = async (
5858 `https://api.github.com/repos/${ options . owner } /${ options . repository } /contents/${ options . specPath } ?ref=${ options . ref } ` ,
5959 {
6060 headers : {
61- "content-type" : "application/json" ,
61+ accept : "application/vnd.github.raw+ json" ,
6262 "user-agent" : "openapi-codegen" ,
6363 authorization : `bearer ${ token } ` ,
6464 } ,
6565 }
66- ) . json < {
67- content : string ;
68- encoding : string | null ;
69- } > ( ) ;
66+ ) . text ( ) ;
7067
71- if ( ! raw . content ) {
68+ if ( ! raw ) {
7269 throw new UsageError ( `No content found at "${ options . specPath } "` ) ;
7370 }
7471
75- const encoding : BufferEncoding =
76- ( raw . encoding as BufferEncoding ) || "base64" ;
77- const textContent = Buffer . from ( raw . content , encoding ) . toString (
78- "utf-8"
79- ) ;
80-
8172 let format : OpenAPISourceFile [ "format" ] = "yaml" ;
8273 if ( options . specPath . toLowerCase ( ) . endsWith ( "json" ) ) {
8374 format = "json" ;
8475 }
8576
86- return { text : textContent , format } ;
77+ return { text : raw , format } ;
8778 } catch ( e ) {
8879 if (
8980 e instanceof HTTPError &&
You can’t perform that action at this time.
0 commit comments