feat: replace baseUrl to prefixUrl when got's next version (#2996)

* enhance: replace baseUrl to prefixUrl when got's next version

* test: baseUrl
This commit is contained in:
Cloud
2019-09-05 12:01:44 +08:00
committed by DIYgod
parent f29d51be1c
commit 4d6257af50
2 changed files with 5 additions and 1 deletions

View File

@@ -40,6 +40,9 @@ const custom = got.extend({
if (options.query) { if (options.query) {
options.searchParams = options.query; // for Got v11 after options.searchParams = options.query; // for Got v11 after
} }
if (options.baseUrl) {
options.prefixUrl = options.baseUrl; // for Got next version
}
}, },
], ],
}, },

View File

@@ -48,7 +48,8 @@ describe('got', () => {
return [200, '{"code": 0}']; return [200, '{"code": 0}'];
}); });
const response1 = await got.post('http://rsshub.test/post', { const response1 = await got.post('post', {
baseUrl: 'http://rsshub.test/',
form: true, form: true,
data: { data: {
test: 1, test: 1,