Skip to content
New issue

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

content-type altered #102

Open
bchr02 opened this issue Jan 17, 2017 · 0 comments
Open

content-type altered #102

bchr02 opened this issue Jan 17, 2017 · 0 comments

Comments

@bchr02
Copy link

bchr02 commented Jan 17, 2017

Using Unirest, I am trying to upload a PDF file to a third party program. This third party program requires the Content-Type to be set like so: application/pdf;name=test.pdf however when I inspect the network traffic I see that Unirest is removing ;name=test.pdf from the Content-Type so that it is only sent with application/pdf. Is there any way to prevent this?

Here is the full code:

const unirest = require('unirest');
const fs = require('fs');
const path = require('path');

var Request = unirest.post('http://192.168.1.200:95/Insert');

Request
.attach('remote file', fs.createReadStream(path.join(__dirname, 'test.pdf'))) // Attachment
.headers({
    'Content-Type': 'application/pdf;name=test.pdf',
})
.end(function (response) {
    console.log(response.body);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant