@frontegg/client
Advanced tools
Comparing version 2.0.18 to 2.0.19
@@ -145,18 +145,23 @@ "use strict"; | ||
proxy.on('proxyReq', function (proxyReq, req, res, _) { | ||
if (req.hostname) { | ||
proxyReq.setHeader('frontegg-vendor-host', req.hostname); | ||
} | ||
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; | ||
try { | ||
if (req.hostname) { | ||
proxyReq.setHeader('frontegg-vendor-host', req.hostname); | ||
} | ||
var bodyData = Buffer.isBuffer(req.body) ? req.body : JSON.stringify(req.body); | ||
contentType = 'application/json'; | ||
contentLength = Buffer.byteLength(bodyData); | ||
proxyReq.write(bodyData); | ||
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); | ||
contentType = 'application/json'; | ||
contentLength = Buffer.byteLength(bodyData); | ||
proxyReq.write(bodyData); | ||
} | ||
} | ||
catch (e) { | ||
logger_1.default.error.apply(logger_1.default, ['could not proxy request to frontegg'].concat(e)); | ||
} | ||
}); | ||
@@ -163,0 +168,0 @@ // tslint:disable-next-line:only-arrow-functions |
{ | ||
"name": "@frontegg/client", | ||
"version": "2.0.18", | ||
"version": "2.0.19", | ||
"description": "Frontegg Javascript Library for backend", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
242777
3553