Skip to content

Binary files do not upload correctly #45

Description

@hypesystem

I was using the library for some simple testing, and got a very obscure issue with binary files not uploading correctly. It looks like they are sent wrongly encoded on the request side.

A simple test case in Node.js:

const fs = require("fs");
const express = require("express");

const app = express();
app.use("/", (req, res) => {
  const writeStream = fs.createWriteStream(req.query.filename || "output.txt");
  req.pipe(writeStream);
  res.send();
});
app.listen(2342);

This creates a HTTP app on port 2342 that writes the body of any request to the filename given as a query parameter, e.g. http://localhost:2342/?filename=uploaded.zip means saving the file to uploaded.zip in the app dir.

If I upload a .zip file like the attached test.zip as a "binary" file via Postcode (latest version, installed today), and try to open the resulting uploaded.zip, it will be invalid.

The same flow works as intended in Postman.

Attachments:

test.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions