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:
21
test/spec_rule/rule/rule_should_use_local_response.js
Normal file
21
test/spec_rule/rule/rule_should_use_local_response.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Rule defination for shouldUseLocalResponse
|
||||
*
|
||||
*/
|
||||
const localData = 'handled_in_local_response';
|
||||
|
||||
module.exports = {
|
||||
*beforeSendRequest(requestDetail) {
|
||||
if (requestDetail.url.indexOf('uselocal') > -1) {
|
||||
return {
|
||||
response: {
|
||||
statusCode: 200,
|
||||
header: {
|
||||
'Via-Proxy-Local': 'true'
|
||||
},
|
||||
body: localData
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user