# |
Mar 2nd 2018, 14:30 |
inoas |
I will try again |
# |
Mar 2nd 2018, 14:30 |
inoas |
and for a cached response you would get back all the response code, response headers etc |
# |
Mar 2nd 2018, 14:30 |
hmic |
inoas, so create a response in your class and feed the data you've got? whats the point? |
# |
Mar 2nd 2018, 14:29 |
hmic |
thats about what i would have thought about the client too. who cares about the inner implementation, you get the body back anyways |
# |
Mar 2nd 2018, 14:29 |
inoas |
much like $response = (new CachedClient)->get($url); |
# |
Mar 2nd 2018, 14:29 |
inoas |
the signature |
# |
Mar 2nd 2018, 14:29 |
inoas |
ah yes what I wanted to do is making sure that the interface does not change |
# |
Mar 2nd 2018, 14:28 |
inoas |
I think I tried that, but I will take a look |
# |
Mar 2nd 2018, 14:28 |
hmic |
the client could need some love probably anyways |
# |
Mar 2nd 2018, 14:28 |
admad |
ionas: $response = (new Client)->get($url); $cacheThis = (string)$response->getBody(); |
# |
Mar 2nd 2018, 14:28 |
hmic |
still, i'm not talking clients :p |
# |
Mar 2nd 2018, 14:28 |
inoas |
Adapter for sending requests. Defaults to Cake\Http\Client\Adapter\Stream |
# |
Mar 2nd 2018, 14:28 |
inoas |
for http clients |
# |
Mar 2nd 2018, 14:27 |
inoas |
it is |
# |
Mar 2nd 2018, 14:27 |
hmic |
and the streaming response is not the default one anyways |
# |
Mar 2nd 2018, 14:27 |
inoas |
$responses = $this->_adapter->send($request, $options); |
# |
Mar 2nd 2018, 14:26 |
hmic |
i'm not talking of requests, but responses anyways |
# |
Mar 2nd 2018, 14:26 |
inoas |
eh no |
# |
Mar 2nd 2018, 14:26 |
hmic |
i suppose still the same idomatic problem: you can't have the "whole" *stream* at once. |
# |
Mar 2nd 2018, 14:26 |
inoas |
which is Psr\Http\Message\RequestInterface |
# |
Mar 2nd 2018, 14:26 |
inoas |
which returns \Cake\Http\Client\Request |
# |
Mar 2nd 2018, 14:25 |
hmic |
*doh* |
# |
Mar 2nd 2018, 14:25 |
inoas |
I am talking about Cake\Http\Client |
# |
Mar 2nd 2018, 14:25 |
hmic |
*not* consumes |
# |
Mar 2nd 2018, 14:25 |
hmic |
client? you are talking about a response! this is a serverResponse cake creates |
# |
Mar 2nd 2018, 14:24 |
inoas |
admad are you sure that that StreamInterface is compatible with Cake\Http\Client\Adapter\Stream ? seems to implement different methods |
# |
Mar 2nd 2018, 14:24 |
inoas |
or a streaming one which passes down a write-target instead of returning the streaming data to the outer functions then to the output buffer |
# |
Mar 2nd 2018, 14:23 |
inoas |
so that i can build a non-streaming adapter |
# |
Mar 2nd 2018, 14:23 |
inoas |
I just need an interface for the 'adapter' |
# |
Mar 2nd 2018, 14:23 |
inoas |
CakePHP's Client has 'adapter' => 'Cake\Http\Client\Adapter\Stream', |
# |
Mar 2nd 2018, 14:22 |
hmic |
it is. just not with a streamed response, as per the definition. |
# |
Mar 2nd 2018, 14:22 |
inoas |
so I want to feed the stream one by one into say redis or a file cache |
# |
Mar 2nd 2018, 14:22 |
inoas |
that is a performance optimization and as HTTP GET is idempotent I should be technically allowed to do so |
# |
Mar 2nd 2018, 14:22 |
hmic |
what do you use the stream for? - things that are so big that they would exhaust the php memory, if not streamed! |
# |
Mar 2nd 2018, 14:21 |
inoas |
I fire HTTP GET requests and want to locally cache the response |
# |
Mar 2nd 2018, 14:21 |
inoas |
again I don't care what I should not |
# |
Mar 2nd 2018, 14:21 |
hmic |
as it's a stream |
# |
Mar 2nd 2018, 14:21 |
hmic |
and you should not |
# |
Mar 2nd 2018, 14:21 |
inoas |
otherwise I cannot cache the response |
# |
Mar 2nd 2018, 14:21 |
inoas |
yes but I need that, the stream to get all data and close |
# |
Mar 2nd 2018, 14:16 |
hmic |
thats the whole idea |