Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public negotiate(resource: IHttpOperation, input: IPrismInput, desiredConfig: IHttpOperationConfig): Promise {
try {
const httpRequest = input.data;
let httpOperationConfig: IHttpOperationConfig;
if (input.validations.input.length > 0) {
httpOperationConfig = helpers.negotiateOptionsForInvalidRequest(resource.responses, httpRequest);
} else {
httpOperationConfig = helpers.negotiateOptionsForValidRequest(resource, desiredConfig, httpRequest);
}
return Promise.resolve({
httpOperationConfig
});
} catch (error) {
return Promise.resolve({
error
});
}
}
}