openid-client
Advanced tools
Comparing version 5.0.1 to 5.0.2
@@ -42,2 +42,15 @@ const assert = require('assert'); | ||
function send(req, body, contentType) { | ||
if (contentType) { | ||
req.removeHeader('content-type'); | ||
req.setHeader('content-type', contentType); | ||
} | ||
if (body) { | ||
req.removeHeader('content-length'); | ||
req.setHeader('content-length', Buffer.byteLength(body)); | ||
req.write(body); | ||
} | ||
req.end(); | ||
} | ||
module.exports = async function request(options, { accessToken, mTLS = false, DPoP } = {}) { | ||
@@ -102,16 +115,12 @@ let url; | ||
return (async () => { | ||
// if (GET (and other && form, json, body)) throw; | ||
if (json) { | ||
req.removeHeader('content-type'); | ||
req.setHeader('content-type', 'application/json'); | ||
req.write(JSON.stringify(json)); | ||
send(req, JSON.stringify(json), 'application/json'); | ||
} else if (form) { | ||
req.removeHeader('content-type'); | ||
req.setHeader('content-type', 'application/x-www-form-urlencoded'); | ||
req.write(querystring.stringify(form)); | ||
send(req, querystring.stringify(form), 'application/x-www-form-urlencoded'); | ||
} else if (body) { | ||
req.write(body); | ||
send(req, body); | ||
} else { | ||
send(req); | ||
} | ||
req.end(); | ||
[response] = await Promise.race([once(req, 'response'), once(req, 'timeout')]); | ||
@@ -118,0 +127,0 @@ |
{ | ||
"name": "openid-client", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "OpenID Connect Relying Party (RP, Client) implementation for Node.js runtime, supports passportjs", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130188
3563