Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpClient] Add an HAR response factory for testing#50807
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Nyholm left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thank you.
If the HAR file can contain multiple request/responses. Then I suggestyielding. That means we can do:
$factory =newHarFileResponseFactory($myHarFile);$client =newMockHttpClient($factory);
Uh oh!
There was an error while loading.Please reload this page.
| $json = json_decode( | ||
| json: file_get_contents($this->archiveFile), | ||
| associative: true, | ||
| flags: \JSON_THROW_ON_ERROR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| flags: \JSON_THROW_ON_ERROR | |
| flags: \JSON_THROW_ON_ERROR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Let's be consistent with the code base and use the "short" version here on one line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Fixed!
fabpot commentedJul 9, 2023
Can you rebase on 7.0 and add a note in the CHANGELOG? |
Uh oh!
There was an error while loading.Please reload this page.
fabpot commentedJul 9, 2023
Thank you@GaryPEGEOT. |
Uh oh!
There was an error while loading.Please reload this page.
From the network tab of most modern browsers, you can save one or more request as an HAR archive file. This pull request adds a way to use those files in test to replay responses previously saved.
Example usage: