Remove content length checks.
This commit is contained in:
parent
db21542d38
commit
b303592f4c
|
@ -187,22 +187,6 @@ export abstract class TestAPI {
|
||||||
expect(response.body).toMatchObject(expectations.body)
|
expect(response.body).toMatchObject(expectations.body)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.text && response.text.length > 0) {
|
|
||||||
// @ts-expect-error - we know this exists, it's just not in the types
|
|
||||||
const request = response.request as Test
|
|
||||||
const contentLength = response.headers["content-length"]
|
|
||||||
if (!contentLength) {
|
|
||||||
throw new Error(
|
|
||||||
`Failed request "${request.method} ${request.url}": Content-Length header not present, but response has a body (body length ${response.text.length})`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (parseInt(contentLength) !== response.text.length) {
|
|
||||||
throw new Error(
|
|
||||||
`Failed request "${request.method} ${request.url}": Content-Length header does not match response body length (header: ${contentLength}, body: ${response.text.length})`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue