We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exports.handleRequest = async (ctx, request) => { const { req, res } = ctx;
// 获取 POST 请求的 Body let requestBody = ''; req.on('data', (chunk) => { requestBody = chunk.toString(); }); req.on('end', async () => { requestBody = JSON.parse(requestBody);
// 在这里根据需要修改请求的 Body 数据 try { requestBody.query_model.sentry_business_id = '-1'; } catch (errr) { console.log(errr) } // // 继续处理其他逻辑 const client = request({...req.headers, data: JSON.stringify(requestBody) }(svrRes) => { res.writeHead(svrRes.statusCode, svrRes.headers); svrRes.pipe(res); }); try { req.pipe(client); await client.write('{"name": "Join"}', 'utf8', () => { console.log(23131323) }); } catch (err) { console.log(err) }
}); };
The text was updated successfully, but these errors were encountered:
如果只是简单修改内容可以用:https://wproxy.org/whistle/rules/resMerge.html 或 https://wproxy.org/whistle/rules/resReplace.html
Sorry, something went wrong.
赞,reqMerge完美解决了这个问题
我也不行。 按照文档里exports.handleRequest = async (ctx, request) => {} 并没有看到图片所示效果
exports.handleRequest = async (ctx, request) => {}
No branches or pull requests
exports.handleRequest = async (ctx, request) => {
const { req, res } = ctx;
// 获取 POST 请求的 Body
let requestBody = '';
req.on('data', (chunk) => {
requestBody = chunk.toString();
});
req.on('end', async () => {
requestBody = JSON.parse(requestBody);
});
};
The text was updated successfully, but these errors were encountered: