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

Fix requesting urls containing parameters with parameters dict #2929

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EnricoMi
Copy link
Collaborator

Requesting an url that contains parameters (query part of the url) did not support giving a parameters dict:

Requester.requestJson(verb, "https://api.github.com/?per_page=10", {"per_page": 20})

Now, parameters given in the URL have precedence over the dict.

Iterating over reversed PaginatedList is affected by this.

Fixes #1136.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.74%. Comparing base (e4106e0) to head (ae187c7).
Report is 1 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2929   +/-   ##
=======================================
  Coverage   96.74%   96.74%           
=======================================
  Files         147      147           
  Lines       14978    14984    +6     
=======================================
+ Hits        14491    14497    +6     
  Misses        487      487           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@JLLeitschuh JLLeitschuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why allow duplicate request parameters at all, why not throw an exception?

If we're doing this internally, this seems like a bug?

@EnricoMi
Copy link
Collaborator Author

EnricoMi commented Apr 5, 2024

You are right, calling this method this way does not make much sense. But the code path that ends up in this situation is complex. Other code paths might suffer from the same issue, and it is not trivial to identify those.

It is expected that the values of the parameters are identical, so this is the right thing to do in that situation. I could throw an exception when parameter values contradict. But then this becomes a breaking change for some people where this just behaved incorrectly.

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.

Paginated list reversed only gives the first page of results backwards
3 participants