MCPcopy Create free account
hub / github.com/cutelyst/cutelyst / headers

Method headers

tests/testrequest.cpp:108–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106
107 C_ATTR(headers, :Local :AutoArgs)
108 void headers(Context *c)
109 {
110 QUrlQuery ret;
111 auto headers = c->request()->headers().data();
112 std::ranges::sort(headers,
113 [](const Headers::HeaderKeyValue &a, const Headers::HeaderKeyValue &b) {
114 return a.key < b.key;
115 });
116
117 for (const auto &header : std::as_const(headers)) {
118 ret.addQueryItem(QString::fromLatin1(header.key), QString::fromLatin1(header.value));
119 }
120 c->response()->setBody(ret.toString(QUrl::FullyEncoded));
121 }
122
123 C_ATTR(userAgent, :Local :AutoArgs)
124 void userAgent(Context *c) { c->response()->setBody(c->request()->userAgent()); }

Callers

nothing calls this directly

Calls 4

dataMethod · 0.80
requestMethod · 0.80
responseMethod · 0.80
setBodyMethod · 0.60

Tested by

no test coverage detected