Skip to content Skip to sidebar Skip to footer

Error: Incorrect Header Check When Running Post

I need to get zip from rest call (for simulation I use postman with binary option for post and add a little zip file with folder and html file),during the simulation I want to get

Solution 1:

zlib is meant to extract gzipped or deflated data, not .ZIP files.

You can use the node-unzip module for those:

var unzip = require('unzip');
...
app.post('/', function(req, res) {
  var extractor = unzip.Extract({ path : 'C://myFolder' }).on('close', function() {
    res.sendStatus(200);
  }).on('error', function(err) {
    res.sendStatus(500);
  });
  req.pipe(extractor);
});

If Postman can't handle uploads like this (as suggested in the comments), you can test using cURL:

$ curl -XPOST localhost:3000 --data-binary @test.zip

Post a Comment for "Error: Incorrect Header Check When Running Post"