File tree 3 files changed +20
-13
lines changed
3 files changed +20
-13
lines changed Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
#include " viewer.h"
3
- #include < unordered_map>
4
3
#include < ydb/library/actors/core/actor_bootstrapped.h>
5
4
#include < ydb/library/actors/core/interconnect.h>
6
5
#include < ydb/library/actors/core/mon.h>
12
11
#include < ydb/core/kqp/common/kqp.h>
13
12
#include < ydb/core/kqp/executer_actor/kqp_executer.h>
14
13
#include < ydb/core/viewer/json/json.h>
15
- // #include <ydb/public/lib/deprecated/kicli/kicli.h>
16
14
#include < ydb/public/lib/json_value/ydb_json_value.h>
17
15
#include < ydb/public/sdk/cpp/client/ydb_result/result.h>
18
16
#include " json_pipe_req.h"
@@ -102,17 +100,8 @@ class TJsonQuery : public TViewerPipeClient<TJsonQuery> {
102
100
}
103
101
}
104
102
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);
116
105
}
117
106
118
107
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) {
83
83
return nullptr ;
84
84
}
85
85
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
+
86
103
}
87
104
}
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ union ViewerWhiteboardCookie {
38
38
};
39
39
40
40
IActor* CreateViewerRequestHandler (TEvViewer::TEvViewerRequest::TPtr& request);
41
+ bool IsPostContent (const NMon::TEvHttpInfo::TPtr& event);
41
42
42
43
}
43
44
}
You can’t perform that action at this time.
0 commit comments