Http Out
Returns the response to an Http Request received from the Http In node.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Input
- Body - Response payload or data (in the format you specify in the Headers option).
- Headers - HTTP response headers.
- Custom Headers - Custom HTTP response headers.
- Cookies - HTTP response cookies.
- Custom Cookies - Custom HTTP response cookies.
- Attachment Path - Path of the file to attach to the response.
- Status Code - HTTP status code.
How It Works
The HTTP Out node sends responses back to HTTP In requests:
-
Request Correlation:
- Retrieves the unique request ID from the message (set by HTTP In)
- Looks up the response channel associated with that request
- Validates that the request still exists and is waiting for a response
-
Response Building:
- Validates status code is provided and non-zero
- Collects body data (JSON object or string)
- Merges headers from Headers input and Custom Headers
- Merges cookies from Cookies input and Custom Cookies
- Validates attachment file if provided (must exist and be a file, not directory)
-
Header and Cookie Processing:
- Iterates through custom headers and adds them to the response
- Iterates through custom cookies and adds them to the response
- Filters out reserved headers (content-length, user-agent)
-
Response Delivery:
- If attachment is specified, sends file as response
- If body is a string, sends as plain text
- If body is an object, sends as JSON
- Sets all headers and cookies
- Returns response to the waiting HTTP client
Requirements
- HTTP In Node: Must be preceded by an HTTP In node in the flow
- Request ID: Message must contain the ID from HTTP In (automatically included)
- Status Code: Must be a valid, non-zero HTTP status code (e.g., 200, 404, 500)
- Attachment File: If provided, must be a valid file path (not a directory)
Error Handling
| Error Code | Description | Solution |
|---|---|---|
Core.Net.HttpOut.ErrOnCreate | Configuration parsing failed during node creation | Check node configuration in the flow |
Core.Net.HttpOut.OnMessage | Message parsing error | Verify message format is valid JSON |
Core.Net.HttpOut.ErrRequest | Request not found or already responded to | Ensure HTTP In preceded this node and response wasn't already sent |
Core.Net.HttpOut.ErrStatus | Invalid status code (zero or missing) | Provide a valid HTTP status code |
Core.Net.HttpOut.InvalidHeader | Custom header configuration error | Check custom headers format and values |
Core.Net.HttpOut.InvalidCookie | Custom cookie configuration error | Check custom cookies format and values |
Core.Net.HttpOut.ErrAttachment | Attachment file not found or is a directory | Verify file path exists and points to a file |
Usage Examples
Example 1: Simple JSON Response
// Responding to an HTTP In request
msg.status = 200;
msg.body = {
success: true,
message: "User created successfully",
userId: 12345
};
msg.headers = {
"Content-Type": "application/json"
};
// After node execution:
// HTTP client receives 200 OK with JSON body
Example 2: Error Response with Custom Headers
// Handle error case
msg.statusCode = 400;
msg.responseBody = {
error: "Invalid input",
details: "Email address is required"
};
msg.responseHeaders = {
"Content-Type": "application/json",
"X-Error-Code": "VALIDATION_ERROR"
};
// After node execution:
// HTTP client receives 400 Bad Request
Example 3: File Download Response
// Send a file as response
msg.status = 200;
msg.attachmentPath = "/home/user/reports/monthly-report.pdf";
msg.headers = {
"Content-Type": "application/pdf",
"Content-Disposition": "attachment; filename=report.pdf"
};
// After node execution:
// HTTP client receives the PDF file for download
Usage Notes
- Status Code Required: Status code must be provided and cannot be zero
- Response Types: Supports JSON objects, plain text strings, and file attachments
- Header Filtering: content-length and user-agent headers are automatically filtered
- Cookie Expiration: Cookies are set with 24-hour expiration by default
- One Response Per Request: Each HTTP In request can only be responded to once
- Request ID: The request ID is automatically carried through the message
- Attachment Priority: If attachment is specified, body is ignored
- Custom vs Regular: Custom headers/cookies are merged with regular headers/cookies
- Header Case: Header names preserve their case as specified
Tips
- Always set appropriate Content-Type headers for your response
- Use standard HTTP status codes (200 for success, 4xx for client errors, 5xx for server errors)
- Set CORS headers if needed for browser-based clients
- Use file attachments for large binary data instead of encoding in JSON
- Combine with HTML Template node for dynamic HTML responses
- Set descriptive error messages in response body
- Include request tracking IDs in responses for debugging
- Use cookies for session management and authentication tokens
- Clean up request ID after sending response (automatically handled)
- Test different status codes to ensure proper error handling
Related Nodes
- HTTP In - Required preceding node to receive requests
- HTML Template - Generate HTML content for responses
- JSON - Format response data as JSON
- File Operations - Read files before sending as attachments
- Conditional - Route to different responses based on request data