{
  "type": "module",
  "source": "doc/api/api-redirecthandler.md",
  "modules": [
    {
      "textRaw": "Class: RedirectHandler",
      "name": "class:_redirecthandler",
      "type": "module",
      "desc": "<p>A class that handles redirection logic for HTTP requests.</p>",
      "signatures": [
        {
          "textRaw": "`new RedirectHandler(dispatch, maxRedirections, opts, handler, redirectionLimitReached)`",
          "name": "RedirectHandler",
          "type": "ctor",
          "params": [
            {
              "name": "dispatch"
            },
            {
              "name": "maxRedirections"
            },
            {
              "name": "opts"
            },
            {
              "name": "handler"
            },
            {
              "name": "redirectionLimitReached"
            }
          ],
          "desc": "<p>Arguments:</p>\n<ul>\n<li><strong>dispatch</strong> <code>function</code> - The dispatch function to be called after every retry.</li>\n<li><strong>maxRedirections</strong> <code>number</code> - Maximum number of redirections allowed.</li>\n<li><strong>opts</strong> <code>object</code> - Options for handling redirection.</li>\n<li><strong>handler</strong> <code>object</code> - An object containing handlers for different stages of the request lifecycle.</li>\n<li><strong>redirectionLimitReached</strong> <code>boolean</code> (default: <code>false</code>) - A flag that the implementer can provide to enable or disable the feature. If set to <code>false</code>, it indicates that the caller doesn't want to use the feature and prefers the old behavior.</li>\n</ul>\n<p>Returns: <code>RedirectHandler</code></p>",
          "modules": [
            {
              "textRaw": "Parameters",
              "name": "parameters",
              "type": "module",
              "desc": "<ul>\n<li><strong>dispatch</strong> <code>(options: Dispatch.DispatchOptions, handlers: Dispatch.DispatchHandlers) => Promise&#x3C;Dispatch.DispatchResponse></code> (required) - Dispatch function to be called after every redirection.</li>\n<li><strong>maxRedirections</strong> <code>number</code> (required) - Maximum number of redirections allowed.</li>\n<li><strong>opts</strong> <code>object</code> (required) - Options for handling redirection.</li>\n<li><strong>handler</strong> <code>object</code> (required) - Handlers for different stages of the request lifecycle.</li>\n<li><strong>redirectionLimitReached</strong> <code>boolean</code> (default: <code>false</code>) - A flag that the implementer can provide to enable or disable the feature. If set to <code>false</code>, it indicates that the caller doesn't want to use the feature and prefers the old behavior.</li>\n</ul>",
              "displayName": "Parameters"
            },
            {
              "textRaw": "Properties",
              "name": "properties",
              "type": "module",
              "desc": "<ul>\n<li><strong>location</strong> <code>string</code> - The current redirection location.</li>\n<li><strong>abort</strong> <code>function</code> - The abort function.</li>\n<li><strong>opts</strong> <code>object</code> - The options for handling redirection.</li>\n<li><strong>maxRedirections</strong> <code>number</code> - Maximum number of redirections allowed.</li>\n<li><strong>handler</strong> <code>object</code> - Handlers for different stages of the request lifecycle.</li>\n<li><strong>history</strong> <code>Array</code> - An array representing the history of URLs during redirection.</li>\n<li><strong>redirectionLimitReached</strong> <code>boolean</code> - Indicates whether the redirection limit has been reached.</li>\n</ul>",
              "displayName": "Properties"
            },
            {
              "textRaw": "Methods",
              "name": "methods",
              "type": "module",
              "methods": [
                {
                  "textRaw": "`onConnect(abort)`",
                  "name": "onConnect",
                  "type": "method",
                  "signatures": [
                    {
                      "params": [
                        {
                          "name": "abort"
                        }
                      ]
                    }
                  ],
                  "desc": "<p>Called when the connection is established.</p>\n<p>Parameters:</p>\n<ul>\n<li><strong>abort</strong> <code>function</code> - The abort function.</li>\n</ul>"
                },
                {
                  "textRaw": "`onUpgrade(statusCode, headers, socket)`",
                  "name": "onUpgrade",
                  "type": "method",
                  "signatures": [
                    {
                      "params": [
                        {
                          "name": "statusCode"
                        },
                        {
                          "name": "headers"
                        },
                        {
                          "name": "socket"
                        }
                      ]
                    }
                  ],
                  "desc": "<p>Called when an upgrade is requested.</p>\n<p>Parameters:</p>\n<ul>\n<li><strong>statusCode</strong> <code>number</code> - The HTTP status code.</li>\n<li><strong>headers</strong> <code>object</code> - The headers received in the response.</li>\n<li><strong>socket</strong> <code>object</code> - The socket object.</li>\n</ul>"
                },
                {
                  "textRaw": "`onError(error)`",
                  "name": "onError",
                  "type": "method",
                  "signatures": [
                    {
                      "params": [
                        {
                          "name": "error"
                        }
                      ]
                    }
                  ],
                  "desc": "<p>Called when an error occurs.</p>\n<p>Parameters:</p>\n<ul>\n<li><strong>error</strong> <code>Error</code> - The error that occurred.</li>\n</ul>"
                },
                {
                  "textRaw": "`onHeaders(statusCode, headers, resume, statusText)`",
                  "name": "onHeaders",
                  "type": "method",
                  "signatures": [
                    {
                      "params": [
                        {
                          "name": "statusCode"
                        },
                        {
                          "name": "headers"
                        },
                        {
                          "name": "resume"
                        },
                        {
                          "name": "statusText"
                        }
                      ]
                    }
                  ],
                  "desc": "<p>Called when headers are received.</p>\n<p>Parameters:</p>\n<ul>\n<li><strong>statusCode</strong> <code>number</code> - The HTTP status code.</li>\n<li><strong>headers</strong> <code>object</code> - The headers received in the response.</li>\n<li><strong>resume</strong> <code>function</code> - The resume function.</li>\n<li><strong>statusText</strong> <code>string</code> - The status text.</li>\n</ul>"
                },
                {
                  "textRaw": "`onData(chunk)`",
                  "name": "onData",
                  "type": "method",
                  "signatures": [
                    {
                      "params": [
                        {
                          "name": "chunk"
                        }
                      ]
                    }
                  ],
                  "desc": "<p>Called when data is received.</p>\n<p>Parameters:</p>\n<ul>\n<li><strong>chunk</strong> <code>Buffer</code> - The data chunk received.</li>\n</ul>"
                },
                {
                  "textRaw": "`onComplete(trailers)`",
                  "name": "onComplete",
                  "type": "method",
                  "signatures": [
                    {
                      "params": [
                        {
                          "name": "trailers"
                        }
                      ]
                    }
                  ],
                  "desc": "<p>Called when the request is complete.</p>\n<p>Parameters:</p>\n<ul>\n<li><strong>trailers</strong> <code>object</code> - The trailers received.</li>\n</ul>"
                },
                {
                  "textRaw": "`onBodySent(chunk)`",
                  "name": "onBodySent",
                  "type": "method",
                  "signatures": [
                    {
                      "params": [
                        {
                          "name": "chunk"
                        }
                      ]
                    }
                  ],
                  "desc": "<p>Called when the request body is sent.</p>\n<p>Parameters:</p>\n<ul>\n<li><strong>chunk</strong> <code>Buffer</code> - The chunk of the request body sent.</li>\n</ul>"
                }
              ],
              "displayName": "Methods"
            }
          ]
        }
      ],
      "displayName": "Class: RedirectHandler"
    }
  ]
}