1. Proxies and Flow

return

Version

Stops processing the request and sends a response back to the client without calling the backend. If the exchange already holds a response, that response is sent; otherwise a new response is built from the request's body and Content-Type. Often paired with template to return a generated body. See the examples under examples/templating.

Example Configuration

api:
port: 2000
flow:
- template:
contentType: application/json
src: '{ "status": "ok" }'
- return:
status: 200
api:
   port: 2000
   flow:
     - template:
         contentType: application/json
         src: '{ "status": "ok" }'
     - return:
         status: 200

Syntax

return:
contentType: <string>
status: <number>
return:
  contentType: <string>
  status: <number>

Attributes

NameRequiredDefaultDescriptionExamples
contentTypefalsenullContent-Type of the response. When unset, an existing response's Content-Type is left unchanged; only when a new response is built from the request is the request's Content-Type used if present, otherwise none is set.application/json; charset=utf-8
statusfalse200HTTP status code to be returned.400

Can be used in