mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-25 09:11:28 +00:00
the fixes are: 1. add "content-type" in headers for when dealing with localresponse 2. make a more accurate tip for throttle rate when lower than 1 3. make the crtMgr funcionality a more independent one 4. uppercase the request header before sending it out update the tip
23 lines
495 B
JavaScript
23 lines
495 B
JavaScript
/*
|
|
* Rule defination for shouldUseLocalResponse
|
|
*
|
|
*/
|
|
|
|
const dealLocalBody = 'handled_in_local_response';
|
|
|
|
module.exports = {
|
|
shouldUseLocalResponse: function (req, reqBody) {
|
|
return req.url.indexOf('uselocal') > -1;
|
|
},
|
|
shouldInterceptHttpsReq: function () {
|
|
return true;
|
|
},
|
|
dealLocalResponse: function (req, reqBody, callback) {
|
|
const header = {
|
|
'Via-Proxy-Local': 'true'
|
|
};
|
|
|
|
callback(200, header, dealLocalBody);
|
|
}
|
|
};
|