Thanks to visit codestin.com
Credit goes to github.com

Skip to content

(WIP) [HttpClient] Add a Record & Replay callback to the MockHttpClient. #30661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

GaryPEGEOT
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets partially #30502
License MIT
Doc PR TODO

Allow to record & replay responses for test / dev purpose:

<?php

$recorder = new FilesystemResponseRecorder('var/fixtures/http');
$callback = new RecordAndReplayCallback($myNamingStrategy, $recorder, RecordAndReplayCallback::MODE_REPLAY_OR_RECORD, $httpClient)

$mockClient = new MockHttpClient($callback);

// Will make an actual HTTP request
$client->request('POST', 'https://example.org/whatever');

// Will replay the previous response
$client->request('POST', 'https://example.org/whatever');

TODO:

  • Provide a default naming strategy
  • Create the PR for the documentation
  • Integrate with Framework bundle for easy config

@GaryPEGEOT
Copy link
Contributor Author

Close in favor of #35677

@GaryPEGEOT GaryPEGEOT deleted the feature/record-replay branch February 14, 2020 13:10
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.1 May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants