Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherit the prefixUrl option from parent if it's undefined #1448

Merged
merged 9 commits into from Sep 9, 2020
Merged

Inherit the prefixUrl option from parent if it's undefined #1448

merged 9 commits into from Sep 9, 2020

Conversation

Giotino
Copy link
Collaborator

@Giotino Giotino commented Sep 9, 2020

Checklist

  • I have read the documentation.
  • I have included a pull request description of my changes.
  • I have included some tests.

Fixes: #1444

@Giotino
Copy link
Collaborator Author

Giotino commented Sep 9, 2020

prefixUrl: '' is the default, but it was overwriting an explicit specified prefixUrl on extend.

Now (in this PR), prefixUrl: '' gets overwritten, but it's impossible to remove it from the options (I think this shouldn't be considered a problem).

The failing cache and stream tests are test that use withServer (which use prefixUrl) but don't really need it, I'm going to remove it.
The failing arguments and timeout tests were using the Got crafted by withServer, but trying to remove prefixUrl which is no more possible.
The last failing test is a pagination test, I'm working on it I rewrote the test (see next comment).

@Giotino
Copy link
Collaborator Author

Giotino commented Sep 9, 2020

The only breaking change (might not be so) that I could find is that with the pagination (if you're using prefixUrl) you can't change the URL returning something like this { url: 'http://something/?page=1234&token=abcd' } in pagination.paginate unless you split the url into prefixUrl and url (in order to overwrite the prefixUrl):

{ 
  prefixUrl: 'http://something/',
  url: '?page=1234&token=abcd'
}

source/core/index.ts Outdated Show resolved Hide resolved
@szmarczak
Copy link
Collaborator

Now (in this PR), prefixUrl: '' gets overwritten, but it's impossible to remove it from the options (I think this shouldn't be considered a problem).

Actually, if we explicitly pass prefixUrl: '' then it should be empty. If it is undefined then it should take the previous value.

@szmarczak szmarczak changed the title Overwrite prefixUrl on merge if empty string Overwrite prefixUrl on merge if undefined Sep 9, 2020
@szmarczak szmarczak changed the title Overwrite prefixUrl on merge if undefined Inherit the prefixUrl option from parent if it's undefined Sep 9, 2020
@szmarczak szmarczak marked this pull request as ready for review September 9, 2020 23:25
@szmarczak szmarczak merged commit a3da70a into sindresorhus:master Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

some defaults are not being respected in normalizeArguments
3 participants