@@ -35,6 +35,7 @@ function Env(name, opts) {
3535 this . dataFile = 'box.dat'
3636 this . logs = [ ]
3737 this . isMute = false
38+ this . isNeedRewrite = false
3839 this . logSeparator = '\n'
3940 this . startTime = new Date ( ) . getTime ( )
4041 Object . assign ( this , opts )
@@ -261,6 +262,10 @@ function Env(name, opts) {
261262 delete opts . headers [ 'Content-Length' ]
262263 }
263264 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+ }
264269 $httpClient . get ( opts , ( err , resp , body ) => {
265270 if ( ! err && resp ) {
266271 resp . body = body
@@ -269,6 +274,10 @@ function Env(name, opts) {
269274 callback ( err , resp , body )
270275 } )
271276 } else if ( this . isQuanX ( ) ) {
277+ if ( this . isNeedRewrite ) {
278+ opts . headers = opts . headers || { }
279+ Object . assign ( opts . headers , { hints : false } )
280+ }
272281 $task . fetch ( opts ) . then (
273282 ( resp ) => {
274283 const { statusCode : status , statusCode, headers, body } = resp
@@ -306,6 +315,10 @@ function Env(name, opts) {
306315 }
307316 if ( opts . headers ) delete opts . headers [ 'Content-Length' ]
308317 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+ }
309322 $httpClient . post ( opts , ( err , resp , body ) => {
310323 if ( ! err && resp ) {
311324 resp . body = body
@@ -315,6 +328,10 @@ function Env(name, opts) {
315328 } )
316329 } else if ( this . isQuanX ( ) ) {
317330 opts . method = 'POST'
331+ if ( this . isNeedRewrite ) {
332+ opts . headers = opts . headers || { }
333+ Object . assign ( opts . headers , { hints : false } )
334+ }
318335 $task . fetch ( opts ) . then (
319336 ( resp ) => {
320337 const { statusCode : status , statusCode, headers, body } = resp
0 commit comments