-
-
Notifications
You must be signed in to change notification settings - Fork 969
Closed
Labels
breakingAPI changes / behavior changesAPI changes / behavior changes
Description
Describe the bug
Actual behavior
The examples show updating hostname
in the options, but if you originally used baseUrl
and then try to modify baseUrl
in your hook, it does not re-derive the url. It seems like inconsistent/unexpected behavior.
Expected behavior
Run the same logic which sets hostname, path, etc if the hook modifies baseUrl
Code to reproduce
const r = got.extend('https://foo.com/path', {
hooks: {
beforeRetry: [
(options, response) => {
options.baseUrl = 'https://bar.com/other-path';
}
]
}
});
await r('/more/path')
In the above example I would expect two requests (if the first failed):
https://foo.com/path/path/more/path
https://bar.com/other-path/more/path
What happens is a second request to https://foo.com/path/path/more/path
.
Checklist
- I have read the documentation.
- I have tried my code with the latest version of Node.js and Got.
Metadata
Metadata
Assignees
Labels
breakingAPI changes / behavior changesAPI changes / behavior changes