Merge pull request #29 from strongloop/feature/workaround-lb-issue-432

Set up default consumes/produces media types
This commit is contained in:
Raymond Feng 2014-08-04 08:37:45 -07:00
commit 689a2f6a86
2 changed files with 5 additions and 2 deletions

View File

@ -28,6 +28,8 @@ var classHelper = module.exports = {
basePath: opts.basePath,
resourcePath: urlJoin('/', opts.resourcePath),
apis: [],
consumes: aClass.http.consumes || opts.consumes,
produces: aClass.http.produces || opts.produces,
models: modelHelper.generateModelDefinition(aClass.ctor, {})
};
},

View File

@ -7,12 +7,10 @@ module.exports = Swagger;
/**
* Module dependencies.
*/
var debug = require('debug')('loopback:explorer:swagger');
var path = require('path');
var urlJoin = require('./url-join');
var _defaults = require('lodash.defaults');
var classHelper = require('./class-helper');
var modelHelper = require('./model-helper');
var routeHelper = require('./route-helper');
/**
@ -28,6 +26,9 @@ function Swagger(loopbackApplication, swaggerApp, opts) {
swaggerVersion: '1.2',
basePath: loopbackApplication.get('restApiRoot') || '/api',
resourcePath: 'resources',
// Default consumes/produces to application/json
consumes: ['application/json'],
produces: ['application/json'],
version: getVersion()
});