Skip to content

POST request key generation. Β #170

Open
@Legion112

Description

Test which.

// Mocking only one response 
$this->addResponse( new EthereumFeeEstimateResponse('0.01', '0.9'));
$this->requestEthereum(new EthereumFeeEstimateRequest('ETH', '199', 'abc', 'address')); // same body
$this->requestEthereum(new EthereumFeeEstimateRequest('ETH', '199', 'abc', 'address')); // same body
$this->shouldMakeCallToTheNetwork(); // Next call should throw "Mock queue is empty"
$this->requestEthereum(new EthereumFeeEstimateRequest('USDT', '199', 'abc', 'address')); // different body.

Expect that the third request will trigger a network call... but instead, it uses cache.

Due to: \Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy::getCacheKey
All CacheStrategyInterface use the following line to generate cache key $request->getMethod().$request->getUri().json_encode($cacheHeaders). Which does not include request body.

I think for POST request it is fair to add body for cache key as well.

Version: kevinrob/guzzle-cache-middleware v3.5.0

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions