@frontegg/client
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -156,8 +156,18 @@ "use strict"; | ||
if (req.body) { | ||
var contentType = proxyReq.getHeader('Content-Type'); | ||
var contentLength = proxyReq.getHeader('Content-Length'); | ||
if (contentType && contentType.startsWith('multipart/form-data')) { | ||
proxyReq.setHeader('Content-Type', contentType); | ||
proxyReq.setHeader('Content-Length', contentLength); | ||
return; | ||
} | ||
var bodyData = Buffer.isBuffer(req.body) ? req.body : JSON.stringify(req.body); | ||
// in case if content-type is application/x-www-form-urlencoded -> we need to change to application/json | ||
proxyReq.setHeader('Content-Type', 'application/json'); | ||
proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData)); | ||
// stream the content | ||
proxyReq.write(bodyData); | ||
if (!contentLength || !contentType || contentType === 'application/x-www-form-urlencoded') { | ||
contentType = 'application/json'; | ||
contentLength = Buffer.byteLength(bodyData); | ||
proxyReq.write(bodyData); | ||
} | ||
proxyReq.setHeader('Content-Type', contentType); | ||
proxyReq.setHeader('Content-Length', contentLength); | ||
} | ||
@@ -164,0 +174,0 @@ }); |
{ | ||
"name": "@frontegg/client", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "Frontegg Javascript Library for backend", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
244322
3615