userver: samples/testsuite-support/src/testpoint.cpp
Loading...
Searching...
No Matches
samples/testsuite-support/src/testpoint.cpp
#include "testpoint.hpp"
namespace tests::handlers {
formats::json::Value Testpoint::HandleRequestJsonThrow(
[[maybe_unused]] const server::http::HttpRequest& request,
[[maybe_unused]] const formats::json::Value& request_body,
[[maybe_unused]] server::request::RequestContext& context
) const {
TESTPOINT("simple-testpoint", [] {
builder["payload"] = "Hello, world!";
return builder.ExtractValue();
}());
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
TESTPOINT_CALLBACK("injection-point", formats::json::Value(), [&result](const formats::json::Value& doc) {
result["value"] = doc["value"].As<std::string>("");
});
return result.ExtractValue();
}
} // namespace tests::handlers