File tree Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Original file line number Diff line number Diff line change 11#pragma once
22#include " viewer.h"
3- #include < unordered_map>
43#include < ydb/library/actors/core/actor_bootstrapped.h>
54#include < ydb/library/actors/core/interconnect.h>
65#include < ydb/library/actors/core/mon.h>
1211#include < ydb/core/kqp/common/kqp.h>
1312#include < ydb/core/kqp/executer_actor/kqp_executer.h>
1413#include < ydb/core/viewer/json/json.h>
15- // #include <ydb/public/lib/deprecated/kicli/kicli.h>
1614#include < ydb/public/lib/json_value/ydb_json_value.h>
1715#include < ydb/public/sdk/cpp/client/ydb_result/result.h>
1816#include " json_pipe_req.h"
@@ -102,17 +100,8 @@ class TJsonQuery : public TViewerPipeClient<TJsonQuery> {
102100 }
103101 }
104102
105- bool IsPostContent () {
106- if (Event->Get ()->Request .GetMethod () == HTTP_METHOD_POST) {
107- const THttpHeaders& headers = Event->Get ()->Request .GetHeaders ();
108- auto itContentType = FindIf (headers, [](const auto & header) { return header.Name () == " Content-Type" ; });
109- if (itContentType != headers.end ()) {
110- TStringBuf contentTypeHeader = itContentType->Value ();
111- TStringBuf contentType = contentTypeHeader.NextTok (' ;' );
112- return contentType == " application/json" ;
113- }
114- }
115- return false ;
103+ bool IsPostContent () const {
104+ return NViewer::IsPostContent (Event);
116105 }
117106
118107 TJsonQuery (IViewer* viewer, NMon::TEvHttpInfo::TPtr& ev)
Original file line number Diff line number Diff line change @@ -83,5 +83,22 @@ IActor* CreateViewerRequestHandler(TEvViewer::TEvViewerRequest::TPtr& request) {
8383 return nullptr ;
8484}
8585
86+ bool IsPostContent (const NMon::TEvHttpInfo::TPtr& event) {
87+ if (event->Get ()->Request .GetMethod () == HTTP_METHOD_POST) {
88+ const THttpHeaders& headers = event->Get ()->Request .GetHeaders ();
89+
90+ auto itContentType = FindIf (headers, [](const auto & header) {
91+ return AsciiEqualsIgnoreCase (header.Name (), " Content-Type" );
92+ });
93+
94+ if (itContentType != headers.end ()) {
95+ TStringBuf contentTypeHeader = itContentType->Value ();
96+ TStringBuf contentType = contentTypeHeader.NextTok (' ;' );
97+ return contentType == " application/json" ;
98+ }
99+ }
100+ return false ;
101+ }
102+
86103}
87104}
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ union ViewerWhiteboardCookie {
3838};
3939
4040IActor* CreateViewerRequestHandler (TEvViewer::TEvViewerRequest::TPtr& request);
41+ bool IsPostContent (const NMon::TEvHttpInfo::TPtr& event);
4142
4243}
4344}
You can’t perform that action at this time.
0 commit comments