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

RequestsMock.add() and .upsert() parameter names are different #734

Open
paulsuh opened this issue Jul 26, 2024 · 4 comments
Open

RequestsMock.add() and .upsert() parameter names are different #734

paulsuh opened this issue Jul 26, 2024 · 4 comments

Comments

@paulsuh
Copy link

paulsuh commented Jul 26, 2024

It's just a little pain point, but .add() uses method while .upsert() uses method_or_response for the HTTP method parameter name. Both can use the same actual values, but the formal names are different.

Why is this a problem (at least for me)? I will sometimes send in the inputs by applying ** to a dict. If the formal parameter names are different, it's a PITA to change the dict keys if I have to swap .add() vs. .upsert().

arg_dict = {
    "method": "GET",
    "url": "https://www.cnn.com/",
    # ...
}
responses.add(**arg_dict)    # this works
responses.upsert(**arg_dict)    # this doesn't

If you think it's worthwhile I can create a little PR to change it.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jul 26, 2024
@markstory
Copy link
Member

If you think it's worthwhile I can create a little PR to change it.

That would be great. We can't remove the method_or_reponse parameter because it would needlessly break compatibility, but adding a method parameter would work. An exception could be raised if both method and method_or_response are provided would be good too.

@beliaev-maksim
Copy link
Collaborator

and add deprecation notice + update readme + changelog

@getsantry
Copy link

getsantry bot commented Aug 20, 2024

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label Aug 20, 2024
@markstory markstory removed the Stale label Aug 26, 2024
@paulsuh
Copy link
Author

paulsuh commented Sep 3, 2024

I'm finally getting a few cycles to work on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

4 participants