HTTP POST request with a JSON payload
HTTP POST with JSON payload
You can write an HTTP request in KATA and have Cerb format and send it to the server as a JSON payload.
When using Content-Type: application/json
, a body:
dictionary will automatically be encoded as JSON.
-
start: http.request/post: output: http_response inputs: method: POST url: https://cerb.example/api/endpoint/ headers: Content-Type: application/json body: name_first: Kina name_last: Halpue email: kina.halpue@cerb.example
-
commands: http.request: deny/method@bool: {{inputs.method not in ['POST']}} deny/url@bool: {{inputs.url is not prefixed ('http://','https://')}} allow@bool: yes