{
  "type": "module",
  "source": "doc/api/api-mockcallhistorylog.md",
  "modules": [
    {
      "textRaw": "MockCallHistoryLog",
      "name": "mockcallhistorylog",
      "introduced_in": "v7.5.0",
      "type": "module",
      "stability": 2,
      "stabilityText": "Stable",
      "desc": "<p>A <code>MockCallHistoryLog</code> is an immutable snapshot of the configuration of a single\nrequest that was intercepted by a <a href=\"MockAgent.html#class-mockagent\"><code>MockAgent</code></a>. Each property mirrors a part\nof the request, with the URL components already parsed by the WHATWG URL parser.</p>\n<p>Instances are not created directly. They are produced by a <a href=\"MockCallHistory.html#class-mockcallhistory\"><code>MockCallHistory</code></a>\nwhen call history is enabled on a <a href=\"MockAgent.html#class-mockagent\"><code>MockAgent</code></a>, and can be retrieved through\nthe call history helpers such as <code>firstCall()</code>, <code>lastCall()</code>, <code>nthCall()</code>,\n<code>calls()</code>, and <code>filterCalls()</code>.</p>\n<pre><code class=\"language-mjs\">import { MockAgent } from 'undici'\n\nconst mockAgent = new MockAgent({ enableCallHistory: true })\n\n// after some requests have been intercepted:\nconst log = mockAgent.getCallHistory()?.firstCall()\n</code></pre>",
      "classes": [
        {
          "textRaw": "Class: `MockCallHistoryLog`",
          "name": "MockCallHistoryLog",
          "type": "class",
          "meta": {
            "added": [
              "v7.5.0"
            ],
            "changes": []
          },
          "desc": "<p>Represents the configuration of one intercepted request.</p>",
          "signatures": [
            {
              "textRaw": "`new MockCallHistoryLog(requestInit)`",
              "name": "MockCallHistoryLog",
              "type": "ctor",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`requestInit` {DispatchOptions} The dispatch options of the intercepted request. **Default:** `{}`.",
                  "name": "requestInit",
                  "type": "DispatchOptions",
                  "default": "`{}`",
                  "desc": "The dispatch options of the intercepted request."
                }
              ],
              "desc": "<p>Creates a new <code>MockCallHistoryLog</code>. The <code>body</code>, <code>headers</code>, and <code>method</code>\nproperties are copied directly from <code>requestInit</code>, while the URL-derived\nproperties (<code>fullUrl</code>, <code>origin</code>, <code>path</code>, <code>searchParams</code>, <code>protocol</code>, <code>host</code>,\n<code>port</code>, and <code>hash</code>) are computed from <code>requestInit.path</code> and <code>requestInit.origin</code>\nusing the WHATWG URL parser.</p>\n<p>This constructor is internal-facing: instances are created by\n<a href=\"MockCallHistory.html#class-mockcallhistory\"><code>MockCallHistory</code></a> when a request is intercepted. It is documented because the\nclass is part of the public API surface.</p>"
            }
          ],
          "properties": [
            {
              "textRaw": "Type: {string|null|undefined}",
              "name": "body",
              "type": "string|null|undefined",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The body of the intercepted request, exactly as supplied to the dispatcher.</p>"
            },
            {
              "textRaw": "Type: {Record}<{string}, {string|string}[]> | {null|undefined}",
              "name": "headers",
              "type": "Record",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The headers of the intercepted request.</p>",
              "shortDesc": "<{string}, {string|string}[]> | {null|undefined}"
            },
            {
              "textRaw": "Type: {string}",
              "name": "method",
              "type": "string",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The HTTP method of the intercepted request, for example <code>'GET'</code> or <code>'PUT'</code>.</p>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "fullUrl",
              "type": "string",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The full URL of the intercepted request, including protocol, host, path, search\nparameters, and hash.</p>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "origin",
              "type": "string",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The origin of the intercepted request, comprising the protocol and host, for\nexample <code>'https://localhost:4000'</code>.</p>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "path",
              "type": "string",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The pathname of the intercepted request. It always starts with <code>/</code> and never\ncontains search parameters.</p>"
            },
            {
              "textRaw": "Type: {Record}<{string}, {string}>",
              "name": "searchParams",
              "type": "Record",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The search parameters of the intercepted request as a plain object of key/value\npairs.</p>",
              "shortDesc": "<{string}, {string}>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "protocol",
              "type": "string",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The protocol of the intercepted request, including the trailing colon, for\nexample <code>'https:'</code> or <code>'http:'</code>.</p>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "host",
              "type": "string",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The host of the intercepted request, including the port when present.</p>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "port",
              "type": "string",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The port of the intercepted request. It is an empty string when no explicit port\nwas used, otherwise a string of digits.</p>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "hash",
              "type": "string",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "desc": "<p>The hash fragment of the intercepted request. It is an empty string when absent,\notherwise a string starting with <code>#</code>.</p>"
            }
          ],
          "methods": [
            {
              "textRaw": "`mockCallHistoryLog.toMap()`",
              "name": "toMap",
              "type": "method",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {Map} A `Map` whose keys are the property names `protocol`, `host`, `port`, `origin`, `path`, `hash`, `searchParams`, `fullUrl`, `method`, `body`, and `headers`, each mapped to the corresponding value of this log.",
                    "name": "return",
                    "type": "Map",
                    "desc": "A `Map` whose keys are the property names `protocol`, `host`, `port`, `origin`, `path`, `hash`, `searchParams`, `fullUrl`, `method`, `body`, and `headers`, each mapped to the corresponding value of this log."
                  }
                }
              ],
              "desc": "<p>Returns the log as a <code>Map</code> of property name to value.</p>\n<pre><code class=\"language-mjs\">mockAgent.getCallHistory()?.firstCall()?.toMap().get('hash')\n// '#hash'\n</code></pre>"
            },
            {
              "textRaw": "`mockCallHistoryLog.toString()`",
              "name": "toString",
              "type": "method",
              "meta": {
                "added": [
                  "v7.5.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {string} A string representation of the log.",
                    "name": "return",
                    "type": "string",
                    "desc": "A string representation of the log."
                  }
                }
              ],
              "desc": "<p>Returns a string built from every property name and value pair. Each pair is\njoined with <code>-></code> and pairs are separated with <code>|</code>. Object values such as\n<code>searchParams</code> and <code>headers</code> are serialized with <code>JSON.stringify()</code>.</p>\n<pre><code class=\"language-mjs\">mockAgent.getCallHistory()?.firstCall()?.toString()\n// protocol->https:|host->localhost:4000|port->4000|origin->https://localhost:4000|path->/endpoint|hash->#here|searchParams->{\"query\":\"value\"}|fullUrl->https://localhost:4000/endpoint?query=value#here|method->PUT|body->\"{ \"data\": \"hello\" }\"|headers->{\"content-type\":\"application/json\"}\n</code></pre>"
            }
          ]
        }
      ]
    }
  ]
}