Fix to ignore global rest query headers when they are not configured.
This commit is contained in:
parent
6e15901847
commit
57b8ae7842
|
@ -9,7 +9,9 @@ export function enrichQueryFields(
|
||||||
parameters = {}
|
parameters = {}
|
||||||
) {
|
) {
|
||||||
const enrichedQuery: { [key: string]: any } = Array.isArray(fields) ? [] : {}
|
const enrichedQuery: { [key: string]: any } = Array.isArray(fields) ? [] : {}
|
||||||
|
if (!fields || !parameters) {
|
||||||
|
return enrichedQuery
|
||||||
|
}
|
||||||
// enrich the fields with dynamic parameters
|
// enrich the fields with dynamic parameters
|
||||||
for (let key of Object.keys(fields)) {
|
for (let key of Object.keys(fields)) {
|
||||||
if (fields[key] == null) {
|
if (fields[key] == null) {
|
||||||
|
|
|
@ -47,10 +47,12 @@ class QueryRunner {
|
||||||
const enrichedContext = { ...enrichedParameters, ...this.ctx }
|
const enrichedContext = { ...enrichedParameters, ...this.ctx }
|
||||||
|
|
||||||
// Parse global headers
|
// Parse global headers
|
||||||
datasource.config.defaultHeaders = enrichQueryFields(
|
if (datasource.config.defaultHeaders) {
|
||||||
datasource.config.defaultHeaders,
|
datasource.config.defaultHeaders = enrichQueryFields(
|
||||||
enrichedContext
|
datasource.config.defaultHeaders,
|
||||||
)
|
enrichedContext
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
let query
|
let query
|
||||||
// handle SQL injections by interpolating the variables
|
// handle SQL injections by interpolating the variables
|
||||||
|
|
Loading…
Reference in New Issue