Skip to content

Commit 22d1649

Browse files
committed
Issue #43: no_cache must be stored in the origParams instead of params in order to disable response caching for external_data queries
1 parent 7c9c426 commit 22d1649

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

scope.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ func (s *scope) decorateRequest(req *http.Request) (*http.Request, url.Values) {
342342
}
343343

344344
// disable cache for external_data queries
345-
params.Set("no_cache", "1")
345+
origParams.Set("no_cache", "1")
346346
log.Debugf("external data params detected - cache will be disabled")
347347
}
348348
}

scope_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,14 +386,14 @@ func TestDecorateRequest(t *testing.T) {
386386
},
387387
},
388388
},
389-
[]string{"query_id", "query", "no_cache", "max_threads", "background_pool_size"},
389+
[]string{"query_id", "query", "max_threads", "background_pool_size"},
390390
},
391391
{
392392
"http://127.0.0.1?user=default&password=default&query=SELECT&testdata_structure=id+UInt32&testdata_format=TSV",
393393
"multipart/form-data; boundary=foobar",
394394
"POST",
395395
nil,
396-
[]string{"query_id", "testdata_structure", "testdata_format", "query", "no_cache"},
396+
[]string{"query_id", "testdata_structure", "testdata_format", "query"},
397397
},
398398
}
399399

@@ -423,7 +423,7 @@ func TestDecorateRequest(t *testing.T) {
423423
}
424424

425425
if len(tc.expectedParams) != len(params) {
426-
t.Fatalf("unexpected params for query %q: %#v", tc.request, params)
426+
t.Fatalf("unexpected params for query %q: got %#v; want %#v", tc.request, params, tc.expectedParams)
427427
}
428428

429429
sort.Strings(params)

0 commit comments

Comments
 (0)