-
Notifications
You must be signed in to change notification settings - Fork 89
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
Can't set "Content-Type" #75
Comments
I don't think that's possible. Are your sure? |
Thanks for quick response @SamDecrock :) For Sharepoint REST API, I need to set the Accept and Content-Type headers to application/json. But it doesn't seem to be working :( Wouldn't I just update the request object in the options like this?
|
There is no object called I think this should work: const options = {
url: 'MySharepointSite',
username: 'USERNAME',
password: '********',
workstation: '',
domain: '',
headers: {
'Accept': 'application/json;odata=verbose',
'Content-Type': 'application/json',
},
}; |
I'm actually seeing the same thing as the OP. I sent my Content-Type as application/x-www-form-urlencoded and this is what I get in the log: Here's the line of code: |
I'm having a similar problem with setting the I can see from httpntlm.js that is is explicitely not using headers passed in via the options: |
Indeed, I will add the option to set custom headers back in. But first I need to write some extra tests to make sure I don't break anything. |
I added the option to pass in custom headers, see https://github.com/SamDecrock/node-http-ntlm#pass-in-custom-headers for an example. This is available from version 1.8.10 |
@SamDecrock This commit f2c71c9 breaks authorization when used with |
When trying to set request to have Content-Type header, then it writes the header as 'Content-type' so the server doesn't parse it, because it's written in quotes ' '.
Anybody got an idea on how I can set the header to have content-type: application/json ?
Thanks in advance
The text was updated successfully, but these errors were encountered: