Appearance
Http response
Sends the HTTP response for a request received by an Http listener. Place it at the end of the request branch; it finds the waiting request through the flow metadata, so it must run in the same branch that started at the listener.
Pins
| Pin | Kind | Types | Description |
|---|---|---|---|
| Input | input | Viaducta.Plugins.Http.Types.WebHttpResponse, Viaducta.Plugins.TextPlugin.Types.TextRecord | The response to send. |
| Continue | continue | Called after the response has been sent, with the same input record. |
Configuration
None besides the common settings.
Behaviour
WebHttpResponse: sendsStatusCode(0means200),Headers(exceptContent-Length,Content-Encoding,Transfer-Encoding),Cookies,ContentTypeand the body.Bodywins overByteBody;Bodyis encoded withContentEncoding(default UTF-8) and acharsetis appended to the content type if missing.ContentFileNameaddsContent-disposition: attachment; filename=.... For status204,205and304no body is sent.TextRecord: sendsValueas body with the record'sContentTypeand status200.- Only one response per request: a second response for the same request fails.
- Then
Continueis called (for logging, cleanup, ...), after the caller already has the response.
Notes
- Errors while sending (no listener metadata, response already sent, client gone) are only logged; the flow continues and
Continueis still called. - Sending to the listener's own
Inputpin does the same thing; use this component when the response is built far away from the listener in the diagram. - If no response is sent at all, the listener returns
500when the flow finishes.
Example
Http listener → Rest handler → Script (build WebHttpResponse with StatusCode 200, ContentType application/json, Body) → Http response