Skip to content
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

When using a customMatcher, the HAR request postData stored in _file is not loading. #20

Closed
TinoChen105 opened this issue May 10, 2024 · 3 comments · Fixed by #21
Closed
Assignees

Comments

@TinoChen105
Copy link
Collaborator

If a request is stored in HAR and only utilizes postData._file for storage, it cannot be accessed when using a customMatcher.

For example:

A HAR file:

  "log": {
    "entries": [
      {
        "request": {
          "method": "POST",
          "url": "https://dev-cb-patch-monitor.quid.com/cb/api/2/runSearches",
          "headers": [],
          "queryString": [],
          "postData": {
            "mimeType": "application/x-www-form-urlencoded",
            "text": "",
            "params": [],
            "_file": "80cfc9ca2ceb7ebb0da70500393558554ef433da.dat"
          }

80cfc9ca2ceb7ebb0da70500393558554ef433da.dat :
product=%22SEARCH%22&searchInfo=false

When using customMatcher:

matcher: (request, entry) => {
			entry.request.postData.params; // This is null
                        entry.request.postData.text; // This is null
		},

How to access entry's postData?
When recording the HAR, only certain requests are saved to _file without any information in text or params. The workaround for this is to use updateContent: 'embed' to avoid it.

@NoamGaash
Copy link
Owner

Thanks @TinoChen105 !
I made a test demonstrating the issue
#21
And now we can do test-driven-development and fix it.

However, there's a performance tradeoff. If we'll read the content of all of the entries before calling the compare functions, it will hurt performance.

Maybe we should export the parseContent function instead? This way, the developer will have control over when they want the file content to be parsed

@TinoChen105
Copy link
Collaborator Author

TinoChen105 commented May 13, 2024

Thanks! Sounds good to me.

@NoamGaash
Copy link
Owner

Great! I made a little fix to allow the matcher to be async. Would you like to be a code reviewer for this PR? #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants