forwardemail / forwardemail/supertest

send request with gzipped body

Open
#493 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14.4k
Forks
782
PR merge metrics
No merged PRs in 30d

Description

I am trying to send a request with the gzipped body with supertest. But body-parser middleware return 400. json is valid json array. endpoint works fine when i send request with postman or curl.

test.js

```
const gzippedBody = zlib.gzipSync(JSON.stringify(json)).toString();
const response = await request(app)
.post('/signals')
.set('api_key', createAccessToken(appID, deviceID))
.set('Content-Type', 'application/json')
.set('Content-Encoding', 'gzip')
.send(gzippedBody);
```

app.js

```
const app = express();
app.use(
bodyParser.json({
limit: '50mb'
})
);

app.use(
bodyParser.urlencoded({
extended: true
})
);
app.use('/signals', signalsRouter);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.