Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// members = members.filter(member => member.id !==
// botEmulator.facilities.users.currentUserId && member.id !== botEmulator.botId);
// members = members.slice(0);
// }
// members.forEach(member => {
// req['conversation'].removeMember(member.id);
// });
// res.send(HttpStatus.OK);
// res.end();
// } catch (err) {
// sendErrorResponse(req, res, next, err);
// }
res.send(HttpStatus.NOT_IMPLEMENTED);
res.end();
next();
}
.then(function(res) {
expect(res).to.have.status(HttpStatus.NOT_IMPLEMENTED);
expect(res).to.be.json;
requiredFields.verifyErrorResponse(res.body);
});
});
.then(function(res) {
expect(res).to.have.status(HttpStatus.NOT_IMPLEMENTED);
expect(res).to.be.json;
requiredFields.verifyErrorResponse(res.body);
});
});
.then(function (res) {
expect(res).to.be.json;
expect(res).to.have.status(HttpStatus.NOT_IMPLEMENTED);
expect(res.body.message).to.equal('NotImplementedError: Not implemented');
});
});
.then(function(res) {
expect(res).to.have.status(HttpStatus.NOT_IMPLEMENTED);
expect(res).to.be.json;
requiredFields.verifyErrorResponse(res.body);
});
});
it('should send a 501', () => {
const req: any = {};
const res: any = {
end: jest.fn(),
send: jest.fn(),
};
const next = jest.fn();
stream(req, res, next);
expect(res.send).toHaveBeenCalledWith(HttpStatus.NOT_IMPLEMENTED);
expect(res.end).toHaveBeenCalled();
expect(next).toHaveBeenCalled();
});
});
it('should send a 501', () => {
const req: any = {};
const res: any = {
end: jest.fn(),
send: jest.fn(),
};
const next = jest.fn();
removeUsers(req, res, next);
expect(res.send).toHaveBeenCalledWith(HttpStatus.NOT_IMPLEMENTED);
expect(res.end).toHaveBeenCalled();
expect(next).toHaveBeenCalled();
});
});
var emitEvent = function(broker, operation, params, processResponse, next) {
var serviceId = params.service_id;
var event = util.format('%s-%s', operation, serviceId);
if (broker.listeners(event).length > 0) {
log.info('Emitting event (%s) for (instanceId: %s).', event, params.instance_id);
broker.emit(event, params, processResponse);
} else {
var errMsg = util.format('%s is not implemented for the service %s in this broker.', operation, serviceId);
return common.handleServiceErrorEx(HttpStatus.NOT_IMPLEMENTED, errMsg, next);
}
};
export function stream(req: Request, res: Response, next: Next): any {
res.send(HttpStatus.NOT_IMPLEMENTED);
res.end();
next();
}
******************************************************************************/
'use strict';
const ITransformerPipelineAction = require('./transformer-pipeline').ITransformerPipelineAction;
const HttpStatusCodes = require('http-status-codes');
const ErrorResponse = require('@adobe/commerce-cif-model').ErrorResponse;
const ERROR_NAME_TO_STATUS_CODE = {
'InvalidArgumentError': HttpStatusCodes.BAD_REQUEST,
'MissingPropertyError': HttpStatusCodes.BAD_REQUEST,
'CommerceServiceResourceNotFoundError': HttpStatusCodes.NOT_FOUND,
'CommerceServiceBadRequestError': HttpStatusCodes.BAD_REQUEST,
'CommerceServiceForbiddenError': HttpStatusCodes.FORBIDDEN,
'CommerceServiceUnauthorizedError': HttpStatusCodes.UNAUTHORIZED,
'NotImplementedError': HttpStatusCodes.NOT_IMPLEMENTED
};
/**
* If the action ended with an error, this transformer maps the error to a status code and updates the response message.
*
* @extends ITransformerPipelineAction
*/
class ExceptionMapperTransformerPipelineAction extends ITransformerPipelineAction {
transform(httpResponse, resultFromOwSequence) {
if (!httpResponse.error) {
return httpResponse;
}
let message;
let reason;
let type;