Remove content length checks.

This commit is contained in:
Sam Rose 2024-03-25 15:30:14 +00:00
parent db21542d38
commit b303592f4c
No known key found for this signature in database
1 changed files with 0 additions and 16 deletions

View File

@ -187,22 +187,6 @@ export abstract class TestAPI {
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
}