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