Skip to content

[BUG] Har files recorded using webkit / chromium are missing postData information #27845

Open
@jcaracciolo

Description

System info

  • Playwright Version: [v1.38.1 and older]
  • Operating System: [Windows, MacOS]
  • Browser: [Chromium, WebKit]
  • Other info:

Source code

  • I provided exact source code that allows reproducing the issue locally.

Code Example

      context.routeFromHAR(this.harPath, {
          update: true,
          updateContent: 'embed'
      });

Steps

  • Setup a context with routeFromHar function being called with the update flag
  • Run a test with one or more POST requests and a body using chromium or webkit

Expected

Har files should have postData value in the POST requests recorded as they do when using firefox. This helps in the future differentiate between POST requests with the same url when replaying the har functionality.

Resulting HAR generated using firefox

       {
         "method": "POST",
          "url": ----?market=US&language=en-US&,
          "httpVersion": "HTTP/2.0",
          "cookies": [],
          "headers": [
            { "name": ":authority", "value": ----},
            { "name": ":method", "value": "POST" },
            { "name": ":path", "value": ----?market=US&language=en-US& },
            { "name": ":scheme", "value": "https" },
            { "name": "accept", "value": "*/*" },
            { "name": "accept-encoding", "value": "gzip, deflate, br" },
            { "name": "accept-language", "value": "en-US" },
            { "name": "content-length", "value": "224" },
            { "name": "content-type", "value": "application/json" },
          ],
          "queryString": [
            {
              "name": "market",
              "value": "US"
            },
            {
              "name": "language",
              "value": "en-US"
            },
          ],
          "headersSize": -1,
          "bodySize": -1,
          "postData":  {
            "mimeType": "application/json",
            "text": xxxx
             "params": []
          }
        },

Actual

Har file has missing the postData value, if there are multiple POST requests to the same resource when replaying the har it will only resolve in the first one.

Resulting HAR generated using Chromium or webkit

       {
         "method": "POST",
          "url": ----?market=US&language=en-US&,
          "httpVersion": "HTTP/2.0",
          "cookies": [],
          "headers": [
            { "name": ":authority", "value": ----},
            { "name": ":method", "value": "POST" },
            { "name": ":path", "value": ----?market=US&language=en-US& },
            { "name": ":scheme", "value": "https" },
            { "name": "accept", "value": "*/*" },
            { "name": "accept-encoding", "value": "gzip, deflate, br" },
            { "name": "accept-language", "value": "en-US" },
            { "name": "content-length", "value": "224" },
            { "name": "content-type", "value": "application/json" },
          ],
          "queryString": [
            {
              "name": "market",
              "value": "US"
            },
            {
              "name": "language",
              "value": "en-US"
            },
          ],
          "headersSize": -1,
          "bodySize": -1
        },

Related Issues

Most likely it is due to something related to these issues, but i see them happening on normal 'application/json' payloads.
request.postData() resolves to null when page uses fetch of FormData with a Blob #24077
Request object does not contain postData for file/blob #6479

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions