provide fix for CR header and backwards compatibility with legacy servers
This commit is contained in:
parent
6983d94d90
commit
6bdf103e11
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
|
||||
|
|
|
@ -79,6 +79,11 @@ module RestModule {
|
|||
required: false,
|
||||
default: {},
|
||||
},
|
||||
legacyHttpParser: {
|
||||
type: DatasourceFieldType.BOOLEAN,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
query: {
|
||||
create: {
|
||||
|
@ -233,9 +238,6 @@ module RestModule {
|
|||
pagination: PaginationConfig | null,
|
||||
paginationValues: PaginationValues | null
|
||||
) {
|
||||
// https://github.com/nodejs/node/issues/43798
|
||||
input.extraHttpOptions = { insecureHTTPParser: true }
|
||||
|
||||
if (!input.headers) {
|
||||
input.headers = {}
|
||||
}
|
||||
|
@ -380,6 +382,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)
|
||||
|
|
|
@ -529,4 +529,21 @@ describe("REST Integration", () => {
|
|||
expect(res.pagination.cursor).toEqual(123)
|
||||
})
|
||||
})
|
||||
|
||||
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