{
  "name": "ezGPT - HTTP errors demo",
  "nodes": [
    {
      "id": "50d8d8aa-00c5-43d2-af0e-f8c00e359f58",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "parameters": {},
      "position": [
        0,
        0
      ]
    },
    {
      "id": "87ef3030-64e1-4c35-a431-1cad9ba1b4ff",
      "name": "Demo Input",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "9c322b65-c68c-4a72-8b7a-182a3bd36d54",
              "name": "url",
              "type": "string",
              "value": "http://host.docker.internal:18111/ok"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "position": [
        220,
        0
      ]
    },
    {
      "id": "4628a1ea-da35-4e86-a737-7f281eae55ef",
      "name": "Fetch Demo",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {
          "timeout": 1000,
          "response": {
            "response": {
              "fullResponse": true,
              "neverError": true,
              "responseFormat": "json"
            }
          }
        }
      },
      "position": [
        440,
        0
      ],
      "onError": "continueErrorOutput"
    },
    {
      "id": "f7af608e-adfc-42d1-b554-c57ad4123830",
      "name": "HTTP Success",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "eabfed77-5281-47e2-80e2-1a3cefa947a6",
              "leftValue": "={{ $json.statusCode }}",
              "rightValue": 200,
              "operator": {
                "type": "number",
                "operation": "gte"
              }
            },
            {
              "id": "2da4f582-3af2-4422-91e6-7158d19a2763",
              "leftValue": "={{ $json.statusCode }}",
              "rightValue": 300,
              "operator": {
                "type": "number",
                "operation": "lt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "position": [
        660,
        -100
      ]
    },
    {
      "id": "8322e083-0025-4410-9981-a6cdff4651e8",
      "name": "Success Result",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "19c1abf1-9f77-43b6-a2ef-3554c39b2431",
              "name": "status",
              "type": "string",
              "value": "ready"
            },
            {
              "id": "2d67d0d9-06e4-4838-80e9-a80fffdefcce",
              "name": "http_status",
              "type": "number",
              "value": "={{ $json.statusCode }}"
            },
            {
              "id": "1f13d48a-a610-4aba-ada1-06d021fae04a",
              "name": "order_id",
              "type": "string",
              "value": "={{ $json.body.order_id }}"
            },
            {
              "id": "ddf204d3-7ad5-498b-ac66-3cbb7e0b25e6",
              "name": "amount",
              "type": "number",
              "value": "={{ $json.body.amount }}"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "position": [
        900,
        -220
      ]
    },
    {
      "id": "932909f5-54df-41c7-8880-c1d342664703",
      "name": "HTTP Failure",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "3acc9b6a-ba2c-4fa8-8a93-c6cc6e1e1cba",
              "name": "status",
              "type": "string",
              "value": "needs_review"
            },
            {
              "id": "677150ea-5c35-4070-9b2f-815bddfae0db",
              "name": "error_kind",
              "type": "string",
              "value": "http"
            },
            {
              "id": "9c17f232-895d-4316-acfa-120338f1443e",
              "name": "http_status",
              "type": "number",
              "value": "={{ $json.statusCode }}"
            },
            {
              "id": "a947cbb4-0d03-483d-9eab-a42cfb2eada1",
              "name": "message",
              "type": "string",
              "value": "={{ $json.body.error ?? \"demo_http_error\" }}"
            },
            {
              "id": "1a71ce91-8472-4c22-8886-3a3c6c576b9e",
              "name": "retry_after",
              "type": "string",
              "value": "={{ String($json.headers[\"retry-after\"] ?? \"\") }}"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "position": [
        900,
        -40
      ]
    },
    {
      "id": "665c49f1-f626-41ca-9550-abae12fb482a",
      "name": "Transport Failure",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ab4fc437-542e-4bcc-ac6e-c23708c1a6cf",
              "name": "status",
              "type": "string",
              "value": "needs_review"
            },
            {
              "id": "64de9301-be82-40ae-bf67-496b1230780e",
              "name": "error_kind",
              "type": "string",
              "value": "transport"
            },
            {
              "id": "3687e986-6507-4292-9524-5251a98271db",
              "name": "message",
              "type": "string",
              "value": "={{ $json.error?.message ?? $json.error ?? \"demo_transport_error\" }}"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "position": [
        660,
        160
      ]
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Demo Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Demo Input": {
      "main": [
        [
          {
            "node": "Fetch Demo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Demo": {
      "main": [
        [
          {
            "node": "HTTP Success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Transport Failure",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Success": {
      "main": [
        [
          {
            "node": "Success Result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Failure",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false,
  "pinData": {}
}
