commit
8a3126826d
File diff suppressed because it is too large
Load Diff
|
@ -34,6 +34,7 @@ export interface RestConfig {
|
|||
defaultHeaders: {
|
||||
[key: string]: any
|
||||
}
|
||||
legacyHttpParser: boolean
|
||||
authConfigs: AuthConfig[]
|
||||
staticVariables: {
|
||||
[key: string]: string
|
||||
|
|
|
@ -80,6 +80,12 @@ module RestModule {
|
|||
required: false,
|
||||
default: {},
|
||||
},
|
||||
legacyHttpParser: {
|
||||
display: "Legacy HTTP Support",
|
||||
type: DatasourceFieldType.BOOLEAN,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
query: {
|
||||
create: {
|
||||
|
@ -379,6 +385,11 @@ module RestModule {
|
|||
paginationValues
|
||||
)
|
||||
|
||||
if (this.config.legacyHttpParser) {
|
||||
// https://github.com/nodejs/node/issues/43798
|
||||
input.extraHttpOptions = { insecureHTTPParser: true }
|
||||
}
|
||||
|
||||
this.startTimeMs = performance.now()
|
||||
const url = this.getUrl(path, queryString, pagination, paginationValues)
|
||||
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