Merge: app.nit: update AsyncHttpRequest API, add examples and a simple implementation
authorJean Privat <jean@pryen.org>
Tue, 21 Jun 2016 13:34:09 +0000 (09:34 -0400)
committerJean Privat <jean@pryen.org>
Tue, 21 Jun 2016 13:34:09 +0000 (09:34 -0400)
commit21ecab90087cba8fa54f9e5706c43734ac25fd74
tree7353b0c75445199473701afe1b590891c5fc7086
parent6b7843413d2f4b762b1c6ebfbcf0ee2a2ccf43ec
parent900e70aa87d071d1141898b8981046d841333311
Merge: app.nit: update AsyncHttpRequest API, add examples and a simple implementation

This PR updates the API of `AsyncHttpRequest`, using more general names for methods and adding a new variation point `uri`. The useful `uri_root` and `uri_tail` are still available as they are more practical to factorize code in real programs. Also provide the `http_status_code` to callbacks when the request succeeded.

Fix a few bugs: correct the ordering of the callback to the UI thread, and join the thread from the UI thread after request is completed.

Intro the new `SimpleAsyncHttpRequest` which prints feedback to the console on errors. It can be used when the response from the server is ignored, or as a quick and dirty first version in the prototype.

Pull-Request: #2188
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>