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

Implement resp_url() helpers #281

Merged
merged 4 commits into from
Aug 23, 2023
Merged

Implement resp_url() helpers #281

merged 4 commits into from
Aug 23, 2023

Conversation

hadley
Copy link
Member

@hadley hadley commented Aug 17, 2023

Fixes #57

Not sure if the query interface should look more like resp_header()/resp_headers(), i.e. is it useful to provide a helper to extract a single query parameter and provide a default if it's not found?

@hadley hadley requested a review from mgirlich August 17, 2023 03:56
R/resp-url.R Show resolved Hide resolved

expect_equal(resp_url(resp), paste0(example_url(), "get?a=1&b=2"))
expect_equal(resp_url_path(resp), "/get")
expect_equal(resp_url_query(resp), list(a = "1", b = "2"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably not really worth the complexity but this examples makes me wonder whether something like a ptypes argument would make sense. It would be nice to easily get list(a = 1, b = 2).

@mgirlich
Copy link
Collaborator

I think it would be nice to have resp_url_queries() and resp_url_query()

@hadley hadley merged commit f28ec8a into main Aug 23, 2023
8 of 12 checks passed
@hadley hadley deleted the resp_url branch August 23, 2023 20:49
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.

Extract query parameters
2 participants