commit
8a3126826d
File diff suppressed because it is too large
Load Diff
|
@ -34,6 +34,7 @@ export interface RestConfig {
|
||||||
defaultHeaders: {
|
defaultHeaders: {
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
legacyHttpParser: boolean
|
||||||
authConfigs: AuthConfig[]
|
authConfigs: AuthConfig[]
|
||||||
staticVariables: {
|
staticVariables: {
|
||||||
[key: string]: string
|
[key: string]: string
|
||||||
|
|
|
@ -80,6 +80,12 @@ module RestModule {
|
||||||
required: false,
|
required: false,
|
||||||
default: {},
|
default: {},
|
||||||
},
|
},
|
||||||
|
legacyHttpParser: {
|
||||||
|
display: "Legacy HTTP Support",
|
||||||
|
type: DatasourceFieldType.BOOLEAN,
|
||||||
|
required: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
create: {
|
create: {
|
||||||
|
@ -379,6 +385,11 @@ module RestModule {
|
||||||
paginationValues
|
paginationValues
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (this.config.legacyHttpParser) {
|
||||||
|
// https://github.com/nodejs/node/issues/43798
|
||||||
|
input.extraHttpOptions = { insecureHTTPParser: true }
|
||||||
|
}
|
||||||
|
|
||||||
this.startTimeMs = performance.now()
|
this.startTimeMs = performance.now()
|
||||||
const url = this.getUrl(path, queryString, pagination, paginationValues)
|
const url = this.getUrl(path, queryString, pagination, paginationValues)
|
||||||
const response = await fetch(url, input)
|
const response = await fetch(url, input)
|
||||||
|
|
|
@ -547,4 +547,21 @@ describe("REST Integration", () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("Configuration options", () => {
|
||||||
|
it("Attaches insecureHttpParams when legacy HTTP Parser option is set", async () => {
|
||||||
|
config = new TestConfiguration({
|
||||||
|
url: BASE_URL,
|
||||||
|
legacyHttpParser: true
|
||||||
|
})
|
||||||
|
await config.integration.read({})
|
||||||
|
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/?`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {},
|
||||||
|
extraHttpOptions: {
|
||||||
|
insecureHTTPParser: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue