-
Notifications
You must be signed in to change notification settings - Fork 0
YAML samples
Derek Clarkson edited this page Nov 19, 2022
·
2 revisions
Here is a simple file that returns a fixed response.
http:
api: get /config
response:
status: 200
body:
json:
version: 1.0
This file contains a number of responses and inclusions. It's a good example of defining multiple responses in a single file.
# Simple endpoint
- http: api: post /created/text
response:
status: 201
headers: ~
body:
text: Hello world!
templateData: ~
# Included YAML file
- TestConfig1/get-config.yml
# Inline javascript dynamic response
- http: api: get /javascript/inline
javascript: |
function response(request, cache) {
if request.parthParameter.accountId == "1234" {
return Response.ok();
} else {
return Response.notFound();
}
}
# Referenced javascript file
- http: api: get /javascript/file
javascriptFile: TestConfig1/login.js
Javascript response file.
function response(request, cache) {
return Response.ok(Body.text("hello world!"));
}