mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-08-04 21:39:04 +00:00
feat: refact requestHandler into TS
This commit is contained in:
@@ -9,14 +9,19 @@
|
||||
module.exports = {
|
||||
*beforeSendRequest(requestDetail) {
|
||||
if (requestDetail.url.indexOf('https://httpbin.org/user-agent') === 0) {
|
||||
console.info(requestDetail._req.connection._peername);
|
||||
const newRequestOptions = requestDetail.requestOptions;
|
||||
requestDetail.protocol = 'http';
|
||||
requestDetail.protocol = 'https';
|
||||
newRequestOptions.hostname = '127.0.0.1'
|
||||
newRequestOptions.port = '8008';
|
||||
newRequestOptions.path = '/index.html';
|
||||
newRequestOptions.port = '3001';
|
||||
newRequestOptions.path = '/test';
|
||||
newRequestOptions.method = 'GET';
|
||||
return requestDetail;
|
||||
}
|
||||
|
||||
if (requestDetail.url.indexOf('http://mobilegw.stable.alipay.net/mgw.htm') === 0) {
|
||||
console.info(requestDetail.requestData.toString())
|
||||
}
|
||||
},
|
||||
*beforeDealHttpsRequest(requestDetail) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user