anyproxy/test/spec_rule/rule/rule_should_intercept_https_req.js
2017-12-01 21:30:49 +08:00

20 lines
442 B
JavaScript

//rule scheme :
module.exports = {
*summary() {
return 'Rule to intercept https request';
},
*beforeSendResponse(requestDetail, responseDetail) {
const newResponse = responseDetail.response;
newResponse.body = newResponse.body.toString() + '_hello_world';
return {
response: newResponse
};
},
*beforeDealHttpsRequest(requestDetail) {
return requestDetail.host.indexOf('localhost:3001') > -1;
}
};