algesten / ureq

A simple, safe HTTP client
Apache License 2.0
1.71k stars 177 forks source link

Ureq 3.x: add a `send_empty` method `RequestBuilder<WithoutBody>` that forwards to `call` #868

Open sosthene-nitrokey opened 2 weeks ago

sosthene-nitrokey commented 2 weeks ago

While it is nice to have the type safety when creating requests, the distinction when creating a GET request without a body and a POST request without a body makes it harder when using code generation such as OpenAPI.

algesten commented 2 weeks ago

Is force_send_body an alternative here? Ideally I'd like to not pollute the API with "useless" functions.

sosthene-nitrokey commented 2 weeks ago

It is. But it seems a bit weird to use it for that.

Another possibility would be to rename send_empty to call().

algesten commented 1 week ago

What about renaming force_send_body to something like erase_typestate (or similar) and introduce a new state Any, that has a single API? I think it would be entirely a surface change.