apigee-127 / swagger-tools

A Node.js and browser module that provides tooling around Swagger.
MIT License
701 stars 374 forks source link

How can I customize 404 response when the URL is not defined. #594

Open TobyTianT opened 5 years ago

TobyTianT commented 5 years ago
  1. Recently when I do the project, I found when the URL was not defined. I get the 404 response with html formatting, like this: < !DOCTYPE html> < html lang="en"> < head> < meta charset="utf-8"> < title>Error < /head> < body> < pre>Cannot GET /api/response/v1.0/test < /body> < /html>

  2. But I need the JSON formatting, for example: { statusCode: 404, message: Cannot GET /api/response/v1.0/test } is there have some way that I can define the json formatting? prompt reply is greatly appreciated.