MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / TestDecorateRequest

Function TestDecorateRequest

scope_test.go:258–395  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

256}
257
258func TestDecorateRequest(t *testing.T) {
259 testCases := []struct {
260 request string
261 contentType string
262 method string
263 userParams *paramsRegistry
264 expectedParams []string
265 }{
266 {
267 "http://127.0.0.1?user=default&password=default&query=SELECT&max_result_bytes=4000000&buffer_size=3000000&wait_end_of_query=1",
268 "text/plain",
269 "GET",
270 nil,
271 []string{"query_id", "session_timeout", "query"},
272 },
273 {
274 "http://127.0.0.1?user=default&password=default&query=SELECT&database=default&wait_end_of_query=1",
275 "text/plain",
276 "GET",
277 nil,
278 []string{"query_id", "session_timeout", "query", "database"},
279 },
280 {
281 "http://127.0.0.1?user=default&password=default&query=SELECT&testdata_structure=id+UInt32&log_comment=log_comment+test",
282 "application/x-www-form-urlencoded",
283 "POST",
284 nil,
285 []string{"query_id", "session_timeout", "query", "log_comment"},
286 },
287 {
288 "http://127.0.0.1?user=default&password=default&query=SELECT&testdata_structure=id+UInt32",
289 "application/x-www-form-urlencoded",
290 "POST",
291 &paramsRegistry{
292 key: uint32(1),
293 params: []config.Param{
294 {
295 Key: "log_comment",
296 Value: "test",
297 },
298 },
299 },
300 []string{"query_id", "session_timeout", "query", "log_comment"},
301 },
302 {
303 "http://127.0.0.1?user=default&password=default&query=SELECT&testdata_structure=id+UInt32&testdata_format=TSV",
304 "application/x-www-form-urlencoded",
305 "POST",
306 &paramsRegistry{
307 key: uint32(1),
308 params: []config.Param{
309 {
310 Key: "max_threads",
311 Value: "1",
312 },
313 },
314 },
315 []string{"query_id", "session_timeout", "query", "max_threads"},

Callers

nothing calls this directly

Calls 3

decorateRequestMethod · 0.95
NewNodeFunction · 0.92
newScopeIDFunction · 0.85

Tested by

no test coverage detected