Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
applyMiddleware(req, next) {
const entries = printRequest(req.request);
// eslint-disable-next-line no-param-reassign
req.options.headers = Object.assign(
{},
req.options.headers,
{
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
'X-CSRF-TOKEN': Config.get('SecurityID'),
}
);
// eslint-disable-next-line no-param-reassign
req.options.body = qs.stringify(Object.assign(
{},
entries,
{ variables: JSON.stringify(entries.variables) }
));
const printRequest = request => {
if (!Object.hasOwnProperty.call(request, 'query')) {
return request;
}
const printedRequest = doPrintRequest(request);
return {
...printedRequest,
query: printedRequest.query.replace(/\s{2,}/g, ' '),
};
};
const printRequest = request => {
if (!Object.hasOwnProperty.call(request, 'query')) {
return request;
}
const printedRequest = doPrintRequest(request);
return {
...printedRequest,
query: printedRequest.query.replace(/\s{2,}/g, ' '),
};
};
const performQuery = ({channel, context}) => new Promise((resolve, reject) => {
const {options, request} = context
const message = docEvent(options)
const payload = printRequest(request)
channel.push(message, payload)
.receive('ok', resolve)
.receive('ignore', resolve)
.receive('error', reject)
.receive('timeout', reject)
})