fix(core): duplicated path if the error is thrown from parameter (#13967)

* fix(core): double namespace if the error is thrown from parameter

* test: fix test case
This commit is contained in:
Tony
2023-12-06 08:00:00 +08:00
committed by GitHub
parent 88241f5cd1
commit 7da162041f
3 changed files with 16 additions and 10 deletions
+7 -5
View File
@@ -33,15 +33,17 @@ describe('rand-user-agent', () => {
});
it('should match ua configurated', async () => {
const response1 = await got('https://httpbingo.org/user-agent');
expect(response1.data['user-agent']).toBe(config.ua);
nock('https://rsshub.test')
.get('/test')
.reply(function () {
return [200, { ua: this.req.headers['user-agent'] }];
});
const response2 = await got('https://httpbingo.org/user-agent', {
const resonse = await got('https://rsshub.test/test', {
headers: {
'user-agent': mobileUa,
},
});
expect(response2.data['user-agent']).toBe(mobileUa);
expect(response2.data['user-agent']).not.toBe(config.ua);
expect(resonse.data.ua).toBe(mobileUa);
});
});