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

Client -> RequestBuilder with a user-provided Method? #260

Closed
aldanor opened this issue Nov 3, 2020 · 7 comments
Closed

Client -> RequestBuilder with a user-provided Method? #260

aldanor opened this issue Nov 3, 2020 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@aldanor
Copy link

aldanor commented Nov 3, 2020

It looks like this has been oversought. How do you create a RequestBuilder from a Client (which may have a base url and the corresponding url logic) if you have a Method and an url?

Maybe something like client.request(Method::Get, "foo") would be worthwhile adding?

(There's Client::send(), but perhaps there might be a more ergonomic option)

@jbr
Copy link
Member

jbr commented Nov 3, 2020

I've run into this as well and think that we can do better than client.send(Request::new(Method::Get, Url::parse("http://_").unwrap()).await?

@aldanor
Copy link
Author

aldanor commented Nov 3, 2020

@jbr Moreover, I think that's not the same thing because of the whole base_url logic? (this part is completely unobvious, as a matter of fact)

@jbr
Copy link
Member

jbr commented Nov 3, 2020

That's true — it diverges if you're using base_url

@Fishrock123
Copy link
Member

I agree, this appears to be an oversight.

I'd take a pr for Client::request(&self, Method, Url) -> RequestBuilder.

@Fishrock123 Fishrock123 added the enhancement New feature or request label Nov 4, 2020
@Fishrock123 Fishrock123 added the good first issue Good for newcomers label Mar 2, 2021
@Fishrock123
Copy link
Member

Fishrock123 commented Mar 2, 2021

Note: once the change described in #237 is made, this would probably change to:

Client::request(&self, Method) -> RequestBuilder

Since Client would normally have a base_url set already. If this form was still needed a request_with_url could be introduced, although I doubt that would be necessary.

@utsavm9
Copy link
Contributor

utsavm9 commented Jun 28, 2021

Hey! Let me know if #308 is the intended function we want to add.

@Fishrock123
Copy link
Member

Done in #308

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants