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