php-http / curl-client

cURL client
http://httplug.io
MIT License
443 stars 28 forks source link

Expose curl_geinfo #34

Closed allflame closed 5 years ago

allflame commented 6 years ago

Added a method to fetch curl_getinfo from the curl resource.

mekras commented 6 years ago

What the purpose of this method?

allflame commented 6 years ago

@mekras I'm not even sure how to describe this more direct. There is no way to inject any logging for connection times, ns lookups etc, which is provided by curl_getinfo. The solution is either to expose the resource itself (which is potentially dangerous) or to expose its state, e.g. through curl_getinfo

mekras commented 6 years ago

It doesn't make sense, because curl-client is just an implementation of HttpClient interface, which doesn't have this method. So it will be unusable.

Nyholm commented 6 years ago

Im 👎 I just removed this function from Buzz. See https://github.com/kriswallsmith/Buzz/pull/291

I would rather add more data to the exception thrown.

allflame commented 6 years ago

The case was not only to fetch data during errors, but for successful requests as well. The other option would be to decorate the response that is generated by the Client, but guess what - all functions are made private and there is "new ResponseBuilder" instatination right there.