1
0
Fork 0
mirror of synced 2024-06-03 02:55:14 +12:00

Merge pull request #7734 from Budibase/fix/cr-header

Fix/cr header
This commit is contained in:
Martin McKeaveney 2022-09-12 12:22:35 +01:00 committed by GitHub
commit 8a3126826d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 1083 deletions

File diff suppressed because it is too large Load diff

View file

@ -34,6 +34,7 @@ export interface RestConfig {
defaultHeaders: {
[key: string]: any
}
legacyHttpParser: boolean
authConfigs: AuthConfig[]
staticVariables: {
[key: string]: string

View file

@ -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)

View file

@ -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
}
})
})
})
})