Open 0Ams opened 1 year ago
it(`should do request with gzip`, async () => { const RESPONSE_BODY = { hello: 'world' }; server.post('/encrypt/body/:id', (_req, res) => res.json(RESPONSE_BODY)); const data = { test: 'json' }; const _data = zlib.gzipSync(Buffer.from(JSON.stringify(data))); await request .post(URI) .set('Content-Encoding', 'gzip') .set('Content-Type', 'application/json') .set('Content-Length', _data.length.toString()) .set('Accept-Encoding', 'gzip') .send(_data); });
The test code was written as above. However, an internal error occurs on the server side...
But, When the server code is the same, the test using curl works fine.
echo '{"test":"json"}' | gzip > test_body.gz curl -v -i -X post http://localhost:8080/gzip -H 'content-encoding: gzip' -H 'content-type: application/json' --data-binary @test_body.gz
I want you to give me a hint to solve this...
(with restify)
The test code was written as above. However, an internal error occurs on the server side...
But, When the server code is the same, the test using curl works fine.
I want you to give me a hint to solve this...
(with restify)