mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-23 15:31:26 +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
|
|
}
|
|
};
|
|
}
|
|
}
|
|
};
|