fix for sending content-type header during GET requests

This commit is contained in:
Tony Tam
2013-04-05 13:29:14 -07:00
parent e66c08907d
commit 8b1cf18daa
3 changed files with 11 additions and 2 deletions

5
dist/swagger-ui.js vendored
View File

@@ -1643,6 +1643,11 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
if (paramContentTypeField) {
obj.contentType = paramContentTypeField;
}
log('content type = ' + obj.contentType);
if (!obj.data || (obj.type === 'GET' || obj.type === 'DELETE')) {
obj.contentType = false;
}
log('content type is now = ' + obj.contentType);
responseContentTypeField = $('.content > .content-type > div > select[name=contentType]', $(this.el)).val();
if (responseContentTypeField) {
obj.headers = obj.headers != null ? obj.headers : {};

File diff suppressed because one or more lines are too long

View File

@@ -153,9 +153,13 @@ class OperationView extends Backbone.View
if paramContentTypeField
obj.contentType = paramContentTypeField
if not obj.data
log 'content type = ' + obj.contentType
if not obj.data or (obj.type is 'GET' or obj.type is 'DELETE')
obj.contentType = false
log 'content type is now = ' + obj.contentType
responseContentTypeField = $('.content > .content-type > div > select[name=contentType]', $(@el)).val()
if responseContentTypeField
obj.headers = if obj.headers? then obj.headers else {}