We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We want to send compressed body by gzip HTTP request in chai-http in mocha.
let chai = require('chai'); let chaiHttp = require('chai-http'); const zlib = require('zlib'); chai.use(chaiHttp); object = { "content": { "data": { "key": "testval" } } }; const objStr = JSON.stringify(object); const objBuf = Buffer.from(objStr, "utf-8"); const bodyContent = zlib.gzipSync(objBuf); const bodyLen = Buffer.byteLength(bodyContent, 'utf-8'); chai.request("http://serverurl") .post('/path') .set('Content-Type', 'application/json') .set('Content-Encoding', 'gzip') .set('Content-Length', bodyLen) .set('Accept-Encoding', 'gzip') .send(bodyContent) .end((err, res) => { expect(err).to.be.null; expect(res).to.have.status(200); done(); });
However, we met the error Error: incorrect header check at Zlib.zlibOnError on the server-side. Is there anything am I missing?
Error: incorrect header check at Zlib.zlibOnError on the server-side
The text was updated successfully, but these errors were encountered:
No branches or pull requests
We want to send compressed body by gzip HTTP request in chai-http in mocha.
However, we met the error
Error: incorrect header check at Zlib.zlibOnError on the server-side
. Is there anything am I missing?The text was updated successfully, but these errors were encountered: