File tree Expand file tree Collapse file tree
packages/mitmproxy/src/lib/interceptor/impl/req Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,17 +32,15 @@ module.exports = {
3232
3333 // status
3434 const status = response . status || 403
35- response . status = status
3635
3736 // body
3837 const body = response . html || response . json || response . script || response . css || response . text || response . body
3938 || `DevSidecar ${ status } : Request abort.\n\n`
4039 + ' This request is matched by abort intercept.\n\n'
4140 + ` 因配置abort拦截器,本请求直接返回${ status } 禁止访问。`
4241
43- // headers
44- const headers = response . headers || { }
45- response . headers = headers
42+ // headers:浅拷贝配置中的 headers,避免将 origin 等请求级数据写入共享的拦截器配置对象
43+ const headers = { ...( response . headers || { } ) }
4644 headers [ 'DS-Interceptor' ] = 'abort'
4745 // headers.Content-Type
4846 if ( status !== 204 ) {
Original file line number Diff line number Diff line change @@ -37,17 +37,15 @@ module.exports = {
3737
3838 // status
3939 const status = response . status || 200
40- response . status = status
4140
4241 // body
4342 const body = response . html || response . json || response . script || response . css || response . text || response . body
4443 || `DevSidecar ${ status } : Request success.\n\n`
4544 + ' This request is matched by success intercept.\n\n'
4645 + ` 因配置success拦截器,本请求直接返回${ status } 成功。`
4746
48- // headers
49- const headers = response . headers || { }
50- response . headers = headers
47+ // headers:浅拷贝配置中的 headers,避免将 origin 等请求级数据写入共享的拦截器配置对象
48+ const headers = { ...( response . headers || { } ) }
5149 headers [ 'DS-Interceptor' ] = 'success'
5250 // headers.Content-Type
5351 if ( status !== 204 ) {
You can’t perform that action at this time.
0 commit comments