userver
C++ Async Framework
Loading...
Searching...
No Matches
samples/testsuite-support/src/testpoint.cpp
#include "
testpoint.hpp
"
#include <
userver/testsuite/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"
, [] {
formats::json::ValueBuilder
builder;
builder[
"payload"
] =
"Hello, world!"
;
return
builder.
ExtractValue
();
}());
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
formats::json::ValueBuilder
result;
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
Generated on Tue Nov 19 2024 11:25:18 for userver by
Doxygen
1.10.0