Httpzoid icon indicating copy to clipboard operation
Httpzoid copied to clipboard

Ading a sync-ed variant of "HttpRequest.send"

Open 3Nigma opened this issue 11 years ago • 0 comments

Hi all, Thank you for taking the time to review this. I present to you 2 modifications that aided me using Httpzoid in my project:

  • I've added a synchronized variant of the "HttpRequest.send" method. Maybe, as it was my case, sometimes a synchronized way of doing REST requests is desired. The previous "send" method has been refactored into "asyncSend" while the current "send" does things in a sync manner.
  • Also, HttpResponse has been converted to an interface as it should be. This allows more flexibility in the "HttpRequest.handler" method call and feels "a little bit more right".

[features not present in this pull request] As a side note, I've also implemented my own "HttpSerializer" that processes JSON using a GsonBuilder factory reference. This allows for custom JSON data serialization via the "GsonBuilder.registerTypeAdapter". To make this possible, I've also made a custom "HttpFactory" that ties everything together. Maybe it's a good thing, I don't know, but it helped me so maybe it can also help others.

That's it for now, Thank you for the library, it's grait!, Vic

3Nigma avatar Jul 02 '14 20:07 3Nigma