Skip to content

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 ​

PinKindTypesDescription
InputinputViaducta.Plugins.Http.Types.WebHttpResponse, Viaducta.Plugins.TextPlugin.Types.TextRecordThe response to send.
ContinuecontinueCalled after the response has been sent, with the same input record.

Configuration ​

None besides the common settings.

Behaviour ​

  • WebHttpResponse: sends StatusCode (0 means 200), Headers (except Content-Length, Content-Encoding, Transfer-Encoding), Cookies, ContentType and the body. Body wins over ByteBody; Body is encoded with ContentEncoding (default UTF-8) and a charset is appended to the content type if missing. ContentFileName adds Content-disposition: attachment; filename=.... For status 204, 205 and 304 no body is sent.
  • TextRecord: sends Value as body with the record's ContentType and status 200.
  • Only one response per request: a second response for the same request fails.
  • Then Continue is 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 Continue is still called.
  • Sending to the listener's own Input pin 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 500 when the flow finishes.

Example ​

Http listener → Rest handler → Script (build WebHttpResponse with StatusCode 200, ContentType application/json, Body) → Http response

Viaducta documentation