Example: send response to http trigger

Python

1
# Returns json response to http trigger
2
from wayscript.triggers import http_trigger
3
4
payload = {"hello": "world"}
5
headers = {"content-type": "application/json"}
6
status_code = 200
7
8
http_trigger.send_response(data=payload, headers=headers, status_code=status_code)
Copied!

JavaScript

1
// Returns json response to http trigger
2
const wayscript = require("wayscript");
3
4
let data = {"hello": "world"};
5
let headers = {"content-type": "application/json"};
6
let status_code = 200;
7
8
wayscript.http_trigger.sendResponse(data, headers, status_code);
Copied!
Export as PDF
Copy link