http-client-common icon indicating copy to clipboard operation
http-client-common copied to clipboard

Feature request: blocking calls

Open thevery opened this issue 6 years ago • 2 comments

Current API is promise-based, you can't do something like val body = client.request().blockingGet().body especially on iOS. Blocking calls are particularly useful for tests but we're using them in app code, too. With rxjava it is super easy to converter blocking call to future and vice versa: Single.fromCallable and Single.blockingGet.

thevery avatar Jul 25 '18 07:07 thevery

particularly useful for tests

By stepping in debugger and stack trace?

blocking call to future and vice versa

I've got it. Thanks for the report.

e5l avatar Jul 25 '18 07:07 e5l

By stepping in debugger and stack trace?

No, it is mostly about API usage:

val messagesObservable: TestObservable = messagesSingle().test()
messagesObservable.assertXXX(...)

vs

val messages: List<Message> = messagesSingle().blockingGet()
assertThat(messages).containsExactly(...)

thevery avatar Jul 25 '18 07:07 thevery