Class HarReplayRules
Matching is exact: a HAR entry replays only for requests whose HTTP method
(case-insensitive) and full request URL (including query string, case-sensitive) are identical
to the entry's recorded request.method/request.url. There is no path/query
normalization, body matching, or wildcarding, unlike
HttpContractRecorder contract replay. Duplicate entries for
the same method/URL are replayed in recorded order, one per matching request, mirroring the
contract replay cursor behavior.
Entries without a response object, or with a non-positive response.status,
are skipped. A response.content.encoding of "base64" is base64-decoded; any
other (or missing) encoding is treated as UTF-8 text. The Content-Length and
Content-Encoding response headers are dropped when replaying, because HAR
response.content.text is always already-decoded per the HAR spec, so passing along the
original transfer headers would misrepresent the reconstructed body.
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<BrowserNetworkInterceptionRule> buildRules(String harFilePath) Builds one mock replay rule from every response-bearing entry in a HAR file.
-
Method Details
-
buildRules
Builds one mock replay rule from every response-bearing entry in a HAR file.- Parameters:
harFilePath- path to a HAR 1.2 JSON file- Returns:
- replay rules that return recorded HAR responses
-