Use `1.0.0` as the default app version.

Change the default version number returned when the version number
cannot be read from `package.json` in CWD.
This commit is contained in:
Miroslav Bajtoš 2014-10-13 17:27:52 +02:00
parent 622f6176f3
commit be36f11629
1 changed files with 5 additions and 5 deletions

View File

@ -110,17 +110,17 @@ function addRoute(app, uri, doc, opts) {
app.get(urlJoin('/', uri), function(req, res) {
// There's a few forces at play that require this "hack". The Swagger spec
// requires a `basePath` to be set in the API descriptions. However, we
// can't guarantee this path is either reachable or desirable if it's set
// requires a `basePath` to be set in the API descriptions. However, we
// can't guarantee this path is either reachable or desirable if it's set
// as a part of the options.
//
//
// The simplest way around this is to reflect the value of the `Host` HTTP
// header as the `basePath`. Because we pre-build the Swagger data, we don't
// know that header at the time the data is built.
if (hasBasePath) {
var headers = req.headers;
var host = headers.Host || headers.host;
doc.basePath = (opts.protocol || req.protocol) + '://' +
doc.basePath = (opts.protocol || req.protocol) + '://' +
host + initialPath;
}
res.status(200).send(doc);
@ -156,7 +156,7 @@ function getVersion() {
try {
version = require(path.join(process.cwd(), 'package.json')).version;
} catch(e) {
version = '';
version = '1.0.0';
}
return version;
}