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

14 lines
345 B
JavaScript

//rule scheme :
module.exports = {
*beforeSendRequest(requestDetail) {
const newOption = requestDetail.requestOptions;
if (newOption.hostname === 'localhost' && newOption.path === '/test/should_replace_option') {
newOption.path = '/test/new_replace_option';
return {
requestOptions: newOption
}
}
}
};