Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I’ve to build a cli HTTP client in Java and went with OkHttp [1], as it was widely used on Android. I’ve to add support for GET requests with a body but I wasn’t able to do it with OkHttp. The library was rather opinionated and you couldn’t add a body to a request body back then [2]. I was rather surprised, because I thought HTTP specs allowed it, while discouraging; so an HTTP library should allow this kind of usage. I went back to Apache HTTPComponents, while less fancy than OkHttp but also less opinionated, and was able to complete my client. Things may have changed, it was a few years ago.

[1] https://github.com/square/okhttp

[2] https://github.com/square/okhttp/issues/5803

[3] https://hc.apache.org/



Yes, OkHttp is somewhat opinionated. You probably shouldn't include an entity body with a GET request unless you really know what you're doing. I wouldn't recommend it anyhow. Years of tradition make this a risky choice.


HTTP specifically says that GET has zero-length (no) request body.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: