Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmine DiMascio committed Mar 22, 2019
1 parent 4b19593 commit 3cf082f
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions index.ts
Expand Up @@ -38,26 +38,22 @@ export interface OpenApiMiddlewareOpts extends OpenAPIFrameworkArgs {

const unsupportedMediaTypeError = {
statusCode: 415,
error: {
errors: [
{
status: 415,
message: 'unsupported media type',
},
],
},
errors: [
{
status: 415,
message: 'unsupported media type',
},
],
};

const notFoundError = {
statusCode: 404,
error: {
errors: [
{
status: 404,
message: 'not found',
},
],
},
status: 404,
errors: [
{
status: 404,
message: 'not found',
},
],
};

export function OpenApiMiddleware(opts: OpenApiMiddlewareOpts) {
Expand Down Expand Up @@ -185,7 +181,6 @@ OpenApiMiddleware.prototype._transformValidationResult = function(
validationResult
) {
if (validationResult && validationResult.errors.length > 0) {
const { errors, status } = validationResult;
const transform =
this.opts.errorTransform ||
(v => ({
Expand Down

0 comments on commit 3cf082f

Please sign in to comment.