Let the crate to build requests without sending
iddm opened this issue · comments
It would be useful for users of this crate just to have everything for requesting via their own method (not using hyper
crate for example). To do this, we must add a method to the UrlShortener
implementation which just returns an object which can be used for making requests by providing all the data: url, parameters, type of parameters, headers, and so on. By having this the user will be able to perform the requests as how it wants. For example, the user code may already have some hyper::Client
instance, we may just use it instead of having our own client. Or, the user may have some another http-client library which he wants to use.
This issue could be done in another way: we use some trait "NetworkSender" with method "send" which the user can implement for it network sender (hyper
client or anything else). Then we write a method of UrlShortener
which accepts a NetworkSender
trait object and uses it for sending the request and getting response.
Fixed in 0.9.0