How to use the http-status-codes.METHOD_NOT_ALLOWED function in http-status-codes

To help you get started, we’ve selected a few http-status-codes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adobe / commerce-cif-magento / test / carts / deleteCartEntryIT.js View on Github external
.then(function(res) {
                    expect(res).to.have.status(HttpStatus.METHOD_NOT_ALLOWED);
                });
        });
github adobe / commerce-cif-magento / test / carts / deleteCouponIT.js View on Github external
.then(function(res) {
                    expect(res).to.have.status(HttpStatus.METHOD_NOT_ALLOWED);
                });
        });
github adobe / commerce-cif-magento / test / carts / getCartIT.js View on Github external
.then(function(res) {
                    expect(res).to.have.status(HttpStatus.METHOD_NOT_ALLOWED);
                });
        });
github Matterwiki / Matterwiki / src / api / utils / constants.js View on Github external
status: HttpStatus.BAD_REQUEST,
    code: "BAD_ARTICLE_UPDATEE",
    message: "title, topicId, change_log and content are required"
  },
  NO_ACCESS: {
    status: HttpStatus.FORBIDDEN,
    code: "NO_ACCESS",
    message: "You are not authorized to perform this action"
  },
  NOT_FOUND: {
    status: HttpStatus.NOT_FOUND,
    code: "NOT_FOUND",
    message: "Resource was not found"
  },
  DELETE_DEFAULT_TOPIC: {
    status: HttpStatus.METHOD_NOT_ALLOWED,
    code: "DELETE_DEFAULT_TOPIC",
    message: "Can not delete default topic!"
  },
  DELETE_DEFAULT_ADMIN: {
    status: HttpStatus.METHOD_NOT_ALLOWED,
    code: "DELETE_DEFAULT_ADMIN",
    message: "Can not delete admin user!"
  }
};

module.exports = {
  SALT_ROUNDS,
  ADMIN_ID,
  TOKEN_EXPIRATION,
  DEFAULT_CHANGELOG_MESSAGE,
  ROLES,
github mesaugat / express-api-es6-starter / src / middlewares / errorHandler.js View on Github external
export function methodNotAllowed(req, res) {
  res.status(HttpStatus.METHOD_NOT_ALLOWED).json({
    error: {
      code: HttpStatus.METHOD_NOT_ALLOWED,
      message: HttpStatus.getStatusText(HttpStatus.METHOD_NOT_ALLOWED)
    }
  });
}
github kube-HPC / hkube / core / api-server / lib / errors / MethodNotAllowed.js View on Github external
const HttpStatus = require('http-status-codes');
const status = HttpStatus.METHOD_NOT_ALLOWED;

class MethodNotAllowed extends Error {
    constructor() {
        super(HttpStatus.getStatusText(status));
        this.status = status;
    }
}

module.exports = MethodNotAllowed;
github Bikranshu / express-react-boilerplate / server / middlewares / errorHandler.js View on Github external
export function methodNotAllowed(req, res) {
    res.status(HttpStatus.METHOD_NOT_ALLOWED).json({
        error: {
            code: HttpStatus.METHOD_NOT_ALLOWED,
            message: HttpStatus.getStatusText(HttpStatus.METHOD_NOT_ALLOWED)
        }
    });
}
github Bikranshu / express-react-boilerplate / server / middlewares / errorHandler.js View on Github external
export function methodNotAllowed(req, res) {
    res.status(HttpStatus.METHOD_NOT_ALLOWED).json({
        error: {
            code: HttpStatus.METHOD_NOT_ALLOWED,
            message: HttpStatus.getStatusText(HttpStatus.METHOD_NOT_ALLOWED)
        }
    });
}
github Matterwiki / Matterwiki / src / api / utils / constants.js View on Github external
status: HttpStatus.FORBIDDEN,
    code: "NO_ACCESS",
    message: "You are not authorized to perform this action"
  },
  NOT_FOUND: {
    status: HttpStatus.NOT_FOUND,
    code: "NOT_FOUND",
    message: "Resource was not found"
  },
  DELETE_DEFAULT_TOPIC: {
    status: HttpStatus.METHOD_NOT_ALLOWED,
    code: "DELETE_DEFAULT_TOPIC",
    message: "Can not delete default topic!"
  },
  DELETE_DEFAULT_ADMIN: {
    status: HttpStatus.METHOD_NOT_ALLOWED,
    code: "DELETE_DEFAULT_ADMIN",
    message: "Can not delete admin user!"
  }
};

module.exports = {
  SALT_ROUNDS,
  ADMIN_ID,
  TOKEN_EXPIRATION,
  DEFAULT_CHANGELOG_MESSAGE,
  ROLES,
  ARTICLE_HISTORY_TYPES,
  ERRORS
};
github Prior99 / hyrest / packages / hyrest / src / answers.ts View on Github external
export function methodNotAllowed(arg1: T | string | Wrapper, arg2?: string): T {
    return answer(HTTP.METHOD_NOT_ALLOWED, arg1, arg2);
}