httpful
httpful copied to clipboard
Current implementation of templates is designed to fail
I like httpful, but there is one component that makes using the whole library feel itchy: The current implementation of templates is designed to fail as soon as you use httpful to communicate with more than one API: Templates are "global".
Scenario:
- Two APIs. We try to connect to both of them through httpful.
- Before calling API A we use the templating system to modify some defaults.
- We call API A - everything works as expected
- Then we call API B.
- Everything explodes because the defaults from API A don't fit.
Instead of
Request::ini($template);
wouldn't it be better to have something like
$r = Request::get($url)->using($template)->...
?
I agree here. The next major revision of the library will get away from much of the static global state, in particular when it comes to templates.
Hi! great suggestion, any news on the implementation? any alternative solution meanwhile?
Yes. I agree this is a major short coming. I identified this as the primary goal for the next major release. On Wed, Nov 23, 2016 at 2:16 PM Raul Plata [email protected] wrote:
Hi! great suggestion, any news on the implementation? any alternative solution meanwhile?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nategood/httpful/issues/175#issuecomment-262606606, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJaA6ovuBcXj-S7oXWB7oU_UYNH3KHnks5rBJEWgaJpZM4EEOYZ .