form-submit.json 1.3 KB

123456789101112131415161718192021222324252627
  1. {
  2. "name": "verify-form-submit",
  3. "nodes": [
  4. {"id": "n1", "name": "Form", "type": "form-trigger", "position": {"x": 0, "y": 0},
  5. "config": {"title": "Upload", "responseMode": "wait",
  6. "fields": [
  7. {"name": "caption", "label": "Caption", "type": "text"},
  8. {"name": "image", "label": "Image", "type": "file", "required": true}
  9. ]}},
  10. {"id": "n2", "name": "Respond", "type": "respond-to-webhook", "position": {"x": 0, "y": 100},
  11. "config": {"status": 200, "bodySource": "json",
  12. "body": "{\"caption\": \"{{$node['Form'].form.caption}}\", \"mime\": \"{{$node['Form'].form.image.mimeType}}\", \"kind\": \"{{$node['Form'].form.image.type}}\", \"size\": {{$node['Form'].form.image.size}}}",
  13. "contentType": "application/json"}}
  14. ],
  15. "connections": [
  16. {"sourceNodeId": "n1", "sourceOutput": "main", "targetNodeId": "n2", "targetInput": "data"}
  17. ],
  18. "http": {
  19. "method": "POST",
  20. "path": "/webhook/{workflowId}",
  21. "multipart": {"fields": {"caption": "a small square"},
  22. "files": {"image": {"filename": "square.png", "contentType": "image/png"}}},
  23. "expectStatus": 200,
  24. "expectBodyContains": ["\"caption\":\"a small square\"", "\"mime\":\"image/png\"", "\"kind\":\"binary\""],
  25. "expectBodyExcludes": ["\"size\":0"]
  26. }
  27. }