4.0怎么替换请求的域名
- Dominant language
- JavaScript
- Stars
- 7.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
module.exports = {
*beforeSendRequest(requestDetail) {
if (requestDetail.url.indexOf('https://ass.ds.net') === 0) {
console.log(requestDetail.url);
const newRequestOptions = requestDetail.requestOptions;
requestDetail.protocol = 'http';
newRequestOptions.hostname = '123.12.221.56'
newRequestOptions.port = '9999';
newRequestOptions.method = 'GET';
console.log(requestDetail.url);
return requestDetail;
}
},
*beforeDealHttpsRequest(requestDetail) {
return true;
}
};
访问https://ass.ds.net/date时,想在请求前修改访问的host,上面的方法修改成访问http://123.12.221.56:9999/date这个是可以成功的,但是host如果是域名,比如http://other.ss.net,这个时候把hostname改成other.ss.net无法访问到http://other.ss.net/date这个地址的数据。请问要怎么修改才可以
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the request to https://ass.ds.net/date with the shown beforeSendRequest and beforeDealHttpsRequest hooks. Trace how requestDetail.requestOptions and hostname are handled for an IP versus a domain, and compare the resulting request URL and headers. Done means documenting or correcting the configuration so the request reaches http://other.ss.net/date as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100