http-error-status-fails.json 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {
  2. "name": "verify-http-error-status-fails",
  3. "comment": "An API that refuses the request fails the node. It used to return normally with ok:false and a warning in the log, so a workflow that posted something and was told no reported success - a run that created nothing was indistinguishable from a run that created everything.\n\nThe second node is the control: the same refusal with the check turned off must still complete, because branching on a status yourself is a real thing to want, and this must not have taken it away.\n\nThe URL is this server's own API without a token, which answers 401 every time. An external status service answered 503 when it felt like it, failing the case for a reason unrelated to what it tests.",
  4. "nodes": [
  5. {
  6. "id": "n1",
  7. "name": "Trigger",
  8. "type": "click-trigger",
  9. "position": {
  10. "x": 0,
  11. "y": 0
  12. },
  13. "config": {}
  14. },
  15. {
  16. "id": "refused",
  17. "name": "Refused request",
  18. "type": "http-request",
  19. "position": {
  20. "x": 0,
  21. "y": 100
  22. },
  23. "config": {
  24. "method": "GET",
  25. "url": "{{API}}/api/v1/workflows",
  26. "responseMode": "text",
  27. "timeout": 30000,
  28. "retries": 0
  29. }
  30. },
  31. {
  32. "id": "tolerated",
  33. "name": "Same refusal, tolerated",
  34. "type": "http-request",
  35. "position": {
  36. "x": 0,
  37. "y": 200
  38. },
  39. "config": {
  40. "method": "GET",
  41. "url": "{{API}}/api/v1/workflows",
  42. "responseMode": "text",
  43. "timeout": 30000,
  44. "retries": 0,
  45. "failOnErrorStatus": false
  46. }
  47. }
  48. ],
  49. "connections": [
  50. {
  51. "sourceNodeId": "n1",
  52. "sourceOutput": "main",
  53. "targetNodeId": "refused",
  54. "targetInput": "data"
  55. },
  56. {
  57. "sourceNodeId": "n1",
  58. "sourceOutput": "main",
  59. "targetNodeId": "tolerated",
  60. "targetInput": "data"
  61. }
  62. ],
  63. "expect": {
  64. "refused": {
  65. "status": "failed",
  66. "errorContains": "returned 401"
  67. },
  68. "tolerated": {
  69. "status": "completed",
  70. "output": {
  71. "ok": false,
  72. "statusCode": 401
  73. }
  74. }
  75. },
  76. "settings": {
  77. "continueOnError": true
  78. }
  79. }