@@ -35,6 +35,7 @@ function Env(name, opts) {
35
35
this . dataFile = 'box.dat'
36
36
this . logs = [ ]
37
37
this . isMute = false
38
+ this . isNeedRewrite = false
38
39
this . logSeparator = '\n'
39
40
this . startTime = new Date ( ) . getTime ( )
40
41
Object . assign ( this , opts )
@@ -261,6 +262,10 @@ function Env(name, opts) {
261
262
delete opts . headers [ 'Content-Length' ]
262
263
}
263
264
if ( this . isSurge ( ) || this . isLoon ( ) ) {
265
+ if ( this . isSurge ( ) && this . isNeedRewrite ) {
266
+ opts . headers = opts . headers || { }
267
+ Object . assign ( opts . headers , { 'X-Surge-Skip-Scripting' : false } )
268
+ }
264
269
$httpClient . get ( opts , ( err , resp , body ) => {
265
270
if ( ! err && resp ) {
266
271
resp . body = body
@@ -269,6 +274,10 @@ function Env(name, opts) {
269
274
callback ( err , resp , body )
270
275
} )
271
276
} else if ( this . isQuanX ( ) ) {
277
+ if ( this . isNeedRewrite ) {
278
+ opts . headers = opts . headers || { }
279
+ Object . assign ( opts . headers , { hints : false } )
280
+ }
272
281
$task . fetch ( opts ) . then (
273
282
( resp ) => {
274
283
const { statusCode : status , statusCode, headers, body } = resp
@@ -306,6 +315,10 @@ function Env(name, opts) {
306
315
}
307
316
if ( opts . headers ) delete opts . headers [ 'Content-Length' ]
308
317
if ( this . isSurge ( ) || this . isLoon ( ) ) {
318
+ if ( this . isSurge ( ) && this . isNeedRewrite ) {
319
+ opts . headers = opts . headers || { }
320
+ Object . assign ( opts . headers , { 'X-Surge-Skip-Scripting' : false } )
321
+ }
309
322
$httpClient . post ( opts , ( err , resp , body ) => {
310
323
if ( ! err && resp ) {
311
324
resp . body = body
@@ -315,6 +328,10 @@ function Env(name, opts) {
315
328
} )
316
329
} else if ( this . isQuanX ( ) ) {
317
330
opts . method = 'POST'
331
+ if ( this . isNeedRewrite ) {
332
+ opts . headers = opts . headers || { }
333
+ Object . assign ( opts . headers , { hints : false } )
334
+ }
318
335
$task . fetch ( opts ) . then (
319
336
( resp ) => {
320
337
const { statusCode : status , statusCode, headers, body } = resp
0 commit comments