HTTP Response Documentation
Version: 1.1.1
Retrieved: 2025-10-09 15:15:56
HTTP Response
The module is used to write a HTTP response back to a requesting client. It is used in combination with the HTTP Listener module.
Settings
| Name | Requirements | Purpose | Default |
|---|---|---|---|
| Status Code | string | The HTTP status code, defaults to '200'. Template syntax can be used. | '200' |
| Content | string | The HTTP response body/content. Template syntax can be used. | 'Hello World' |
| Headers | Key/Value pairs | Optional headers to attach to the HTTP response. | |
| Target Property | string | The property (optional) containing the response that was sent back. | 'data' |
Input
The input to this module will be the output from the HTTP Listener module. The input can of course contain other data as well, but this is the basic needs for the HTTP Response module.
| Name | Type | Description |
|---|---|---|
| path | string | The path name of the HTTP request |
| body | byte[] | The actual payload of the HTTP request. |
| headers | Key/Value pairs | HTTP headers |
| query | Key/Value pairs | The query string of the HTTP request |
| verb | string | The VERB of the request |
| statusCode | int | The status code used in the response |
Output
The output will be based on the input, but properties may have been changed by settings in the HTTP Response module. The output will place the response on the Target Property.
Basic Example
We assume that there is a flow with at least 2 modules. One HTTP LIstener module and one HTTP Response module. The HTTP Listener is configured to listen for the path foo/bar.
Settings
Status Code: 200 Content: Hello World Target Property: data
Input
We will trigger the HTTP Listener using CURL, but any HTTP client works.
CURL:
curl --data '{"tool": "curl"}' --header "Accept: application/json" --header "Content-Type: application/json" http://localhost:9090/foo/bar
This will generate this output from the HTTP Listener (which will be input to the HTTP Response).
{
"$httpRequestId": "ca5c3807-f4ef-41fc-b293-d841c2b3a2cf",
"crosser": {
"success": true
},
"data": {
"body": {
"tool": "curl"
},
"headers": {
"accept": "application/json",
"content-length": "16",
"content-type": "application/json",
"host": "localhost:9090",
"origin": "localhost:9090",
"user-agent": "curl/7.81.0"
},
"path": "foo/bar",
"query": {},
"verb": "POST",
"statusCode": 200
}
}
Output
Output to the next module
{
"$httpRequestId": "ca5c3807-f4ef-41fc-b293-d841c2b3a2cf",
"crosser": {
"success": true
},
"data": {
"body": "Hello World",
"headers": {
"Connection": "Keep-Alive",
"content-type": "application/json",
"Date": "Mon, 29 Jan 2024 20:20:24 GMT",
"Server": "Crosser"
},
"path": "foo/bar",
"query": {},
"statusCode": 200,
"verb": "POST"
}
}
Response to the requesting client (in this case CURL)
< HTTP/1.1 200 OK < content-type: application/json < Date: Mon, 29 Jan 2024 20:24:00 GMT < Connection: Keep-Alive < Server: Crosser < Content-Length: 11 < Hello World
Example With Template Syntax
Using template syntax is a bit more complex but very powerful. We assume that we after the HTTP Listener module make a call to some external resource (file, database, REST-API etc) and then store the result on the flow-message property named data.body. Now we can tell the HTTP Response module to use that property as the response body.
We assume that the HTTP Listener module listens for the path albums/+. So that we can ask for any album id with for example http://localhost:9090/albums/43. You can of course use query-strings to build up a query to get data as well.
Settings
Note that we now use template syntax to point out where the body for the response is located. We also use the statusCode from the HTTP Request module with template syntax.
Status Code: {data.statusCode}
Content: {data.body}
Target Property: data
We will trigger the HTTP Listener using CURL, but any HTTP client works.
CURL:
curl --header "Accept: application/json" http://localhost:9090/albums/3
Now the HTTP Listener module will send the request to your module of choice to collect album data and then the HTTP Response module will get the result to send back.
When building the example we used a HTTP Request module to get album data from https://jsonplaceholder.typicode.com.
Input To The HTTP Response Module
{
"$httpRequestId": "9179eb3a-5258-45fa-b761-bbe916af7e3a",
"crosser": {
"success": true
},
"data": {
"body": "{\n \"userId\": 1,\n \"id\": 3,\n \"title\": \"omnis laborum odio\"\n}",
"duration": 40.162,
"statusCode": 200
},
"url": "https://jsonplaceholder.typicode.com/albums/3"
}
Output
Output to the next module
{
"$httpRequestId": "9179eb3a-5258-45fa-b761-bbe916af7e3a",
"crosser": {
"success": true
},
"data": {
"body": "{\n \"userId\": 1,\n \"id\": 3,\n \"title\": \"omnis laborum odio\"\n}",
"duration": 40.162,
"headers": {
"Connection": "Keep-Alive",
"content-type": "application/json",
"Date": "Tue, 30 Jan 2024 10:00:46 GMT",
"Server": "Crosser"
},
"statusCode": 200
},
"url": "https://jsonplaceholder.typicode.com/albums/3"
}
Response to the requesting client (in this case CURL)
< HTTP/1.1 200 OK
< content-type: application/json
< Date: Tue, 30 Jan 2024 10:00:46 GMT
< Connection: Keep-Alive
< Server: Crosser
< Content-Length: 61
<
{
"userId": 1,
"id": 3,
"title": "omnis laborum odio"
}
Search Documentation
Protocols