send pre-made response
| 1480 | |
| 1481 | // send pre-made response |
| 1482 | WasmResult |
| 1483 | Context::sendLocalResponse(uint32_t response_code, std::string_view body_text, Pairs additional_headers, |
| 1484 | GrpcStatusCode /* grpc_status */, std::string_view details) |
| 1485 | { |
| 1486 | if (txnp_ == nullptr) { |
| 1487 | TSError("[wasm][%s] Can't send local response without a transaction", __FUNCTION__); |
| 1488 | return WasmResult::InternalFailure; |
| 1489 | } else { |
| 1490 | TSHttpTxnStatusSet(txnp_, static_cast<TSHttpStatus>(response_code)); |
| 1491 | |
| 1492 | if (body_text.size() > 0) { |
| 1493 | TSHttpTxnErrorBodySet(txnp_, TSstrndup(body_text.data(), body_text.size()), body_text.size(), |
| 1494 | nullptr); // Defaults to text/html |
| 1495 | } |
| 1496 | |
| 1497 | local_reply_headers_ = additional_headers; |
| 1498 | local_reply_details_ = details; |
| 1499 | local_reply_ = true; |
| 1500 | } |
| 1501 | return WasmResult::Ok; |
| 1502 | } |
| 1503 | |
| 1504 | WasmResult |
| 1505 | Context::getSharedData(std::string_view key, std::pair<std::string, uint32_t> *data) |
nothing calls this directly
no test coverage detected