Files
few-line-engine/tests/base/case1-payload.js

41 lines
857 B
JavaScript

/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable no-undef */
import "module/squel";
import "plugin/db";
import "plugin/axios";
function createSQL(id) {
return squel.select().from("test").where("id = ?", id).toString();
}
async function main(input, headers) {
const sql = createSQL(input.id);
await db.query("START TRANSACTION");
// log(await db.query('insert into test (name) values ("Test")'));
log(new Date().toISOString());
// const a = await axios.get("https://httpbin.dev/delay/10", {
// timeout: 50000000,
// });
// log(a);
const res = await db.query(`
SELECT SLEEP(10000);
`);
log(new Date().toISOString());
return {
response: {
test: 1,
array: [1, 2, [{ id: 1, name: "Test" }]],
},
statusCode: 201,
headers: { "x-test-header": "test-header-value" },
};
}