Merge pull request #29 from strongloop/feature/workaround-lb-issue-432
Set up default consumes/produces media types
This commit is contained in:
commit
689a2f6a86
|
@ -28,6 +28,8 @@ var classHelper = module.exports = {
|
||||||
basePath: opts.basePath,
|
basePath: opts.basePath,
|
||||||
resourcePath: urlJoin('/', opts.resourcePath),
|
resourcePath: urlJoin('/', opts.resourcePath),
|
||||||
apis: [],
|
apis: [],
|
||||||
|
consumes: aClass.http.consumes || opts.consumes,
|
||||||
|
produces: aClass.http.produces || opts.produces,
|
||||||
models: modelHelper.generateModelDefinition(aClass.ctor, {})
|
models: modelHelper.generateModelDefinition(aClass.ctor, {})
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,12 +7,10 @@ module.exports = Swagger;
|
||||||
/**
|
/**
|
||||||
* Module dependencies.
|
* Module dependencies.
|
||||||
*/
|
*/
|
||||||
var debug = require('debug')('loopback:explorer:swagger');
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var urlJoin = require('./url-join');
|
var urlJoin = require('./url-join');
|
||||||
var _defaults = require('lodash.defaults');
|
var _defaults = require('lodash.defaults');
|
||||||
var classHelper = require('./class-helper');
|
var classHelper = require('./class-helper');
|
||||||
var modelHelper = require('./model-helper');
|
|
||||||
var routeHelper = require('./route-helper');
|
var routeHelper = require('./route-helper');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +26,9 @@ function Swagger(loopbackApplication, swaggerApp, opts) {
|
||||||
swaggerVersion: '1.2',
|
swaggerVersion: '1.2',
|
||||||
basePath: loopbackApplication.get('restApiRoot') || '/api',
|
basePath: loopbackApplication.get('restApiRoot') || '/api',
|
||||||
resourcePath: 'resources',
|
resourcePath: 'resources',
|
||||||
|
// Default consumes/produces to application/json
|
||||||
|
consumes: ['application/json'],
|
||||||
|
produces: ['application/json'],
|
||||||
version: getVersion()
|
version: getVersion()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue