Skip to content

Commit

Permalink
Fixed issue with mixed auth.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-KaiNet committed Nov 7, 2017
1 parent 6196f03 commit f4a9403
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "sp-request",
"version": "2.1.0",
"version": "2.1.2",
"description": "Simplified SharePoint HTTP client",
"main": "./lib/src/index.js",
"typings": "./lib/src/index",
Expand Down
8 changes: 7 additions & 1 deletion src/core/SPRequest.ts
Expand Up @@ -15,7 +15,7 @@ import { Cache } from './utils/Cache';
export let requestDigestCache: Cache = new Cache();

const isUrlHttps: any = (url: string): boolean => {
return url.split('://')[0].toLowerCase() === 'https';
return url.split('://')[0].toLowerCase() === 'https';
};

export function create(credentials?: spauth.IAuthOptions): ISPRequest {
Expand All @@ -38,6 +38,12 @@ export function create(credentials?: spauth.IAuthOptions): ISPRequest {
'Content-Type': 'application/json;odata=verbose'
});

let additionalHeadersStr: string = process.env['_sp_request_headers'];
if (additionalHeadersStr) {
let additionalHeaders: any = JSON.parse(additionalHeadersStr);
_.assign(options.headers, additionalHeaders);
}

_.defaults(options, {
json: true,
strictSSL: false,
Expand Down

0 comments on commit f4a9403

Please sign in to comment.