mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-23 16:21:25 +00:00
18 lines
413 B
JavaScript
18 lines
413 B
JavaScript
//rule scheme : replace the reponse data
|
|
|
|
module.exports = {
|
|
|
|
*beforeSendResponse(requestDetail, responseDetail) {
|
|
if (requestDetail.url.indexOf('/test/normal_request1') > -1) {
|
|
const newResponse = responseDetail.response;
|
|
|
|
const newDataStr = newResponse.body.toString() + '_hello_world!';
|
|
newResponse.body = newDataStr;
|
|
|
|
return {
|
|
response: newResponse
|
|
};
|
|
}
|
|
}
|
|
};
|