mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-05-12 17:18:29 +00:00
22 lines
403 B
JavaScript
22 lines
403 B
JavaScript
|
/*
|
||
|
* 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
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
};
|