mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-08-04 21:39:04 +00:00
update to 4.0
This commit is contained in:
20
test/spec_rule/rule/rule_replace_response_status_code.js
Normal file
20
test/spec_rule/rule/rule_replace_response_status_code.js
Normal file
@@ -0,0 +1,20 @@
|
||||
//replace all the images with local one
|
||||
module.exports = {
|
||||
|
||||
*summary() {
|
||||
return 'replace the response status code.';
|
||||
},
|
||||
|
||||
*beforeSendResponse(requestDetail, responseDetail) {
|
||||
if (requestDetail.url.indexOf('/test/normal_request1') >= 0) {
|
||||
const newResponse = responseDetail.response;
|
||||
newResponse.statusCode = 302;
|
||||
newResponse.header.location = 'www.taobao.com';
|
||||
|
||||
return {
|
||||
response: newResponse
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user