File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " leetcode-query " : patch
3+ ---
4+
5+ Check response status before returning GraphQL data
Original file line number Diff line number Diff line change @@ -119,6 +119,10 @@ export class LeetCodeCN extends EventEmitter {
119119 } ,
120120 body : JSON . stringify ( query ) ,
121121 } ) ;
122+ if ( ! res . ok ) {
123+ throw new Error ( `HTTP ${ res . status } ${ res . statusText } : ${ await res . text ( ) } ` ) ;
124+ }
125+
122126 this . emit ( "receive-graphql" , res . clone ( ) ) ;
123127
124128 if ( res . headers . has ( "set-cookie" ) ) {
Original file line number Diff line number Diff line change @@ -364,6 +364,10 @@ export class LeetCode extends EventEmitter {
364364 } ,
365365 body : JSON . stringify ( query ) ,
366366 } ) ;
367+ if ( ! res . ok ) {
368+ throw new Error ( `HTTP ${ res . status } ${ res . statusText } : ${ await res . text ( ) } ` ) ;
369+ }
370+
367371 this . emit ( "receive-graphql" , res . clone ( ) ) ;
368372
369373 if ( res . headers . has ( "set-cookie" ) ) {
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ export default defineConfig((options) => ({
77 format : [ "cjs" , "esm" ] ,
88 clean : true ,
99 splitting : false ,
10- minify : ! options . watch ,
1110 dts : options . watch ? false : { resolve : true } ,
1211 esbuildOptions ( opt ) {
1312 opt . loader = {
You can’t perform that action at this time.
0 commit comments