fix: buildReqObject headers for socket.io calls

v1.18.x
Barış Soner Uşaklı 4 years ago
parent 3b98d83a6b
commit ed534f34f5

@ -20,7 +20,7 @@ exports.setDefaultPostData = function (reqOrSocket, data) {
// creates a slimmed down version of the request object // creates a slimmed down version of the request object
exports.buildReqObject = (req, payload) => { exports.buildReqObject = (req, payload) => {
req = req || {}; req = req || {};
const headers = req.headers || {}; const headers = req.headers || (req.client && req.client.request && req.client.request.headers) || {};
const encrypted = req.connection ? !!req.connection.encrypted : false; const encrypted = req.connection ? !!req.connection.encrypted : false;
let { host } = headers; let { host } = headers;
const referer = headers.referer || ''; const referer = headers.referer || '';

@ -8,7 +8,7 @@ const privileges = require('../../privileges');
const controllersHelpers = require('../../controllers/helpers'); const controllersHelpers = require('../../controllers/helpers');
module.exports = function (SocketCategories) { module.exports = function (SocketCategories) {
// used by categorySeach module // used by categorySearch module
SocketCategories.categorySearch = async function (socket, data) { SocketCategories.categorySearch = async function (socket, data) {
let cids = []; let cids = [];
let matchedCids = []; let matchedCids = [];

Loading…
Cancel
Save