From ae93b581d2d5960cf1f9eccb5847141298adbe45 Mon Sep 17 00:00:00 2001 From: Johannes Dewender Date: Sun, 17 Mar 2013 22:36:17 +0100 Subject: [PATCH] don't set contentType for empty body When content-type is set to a non-standard value, CORS requires a preflight request that needs to be handled by the destination server. We shouldn't require that, when no body is sent at all and the content-type is irrelevant anyways. --- src/main/coffeescript/view/OperationView.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/coffeescript/view/OperationView.coffee b/src/main/coffeescript/view/OperationView.coffee index 54f998a3..4712f830 100644 --- a/src/main/coffeescript/view/OperationView.coffee +++ b/src/main/coffeescript/view/OperationView.coffee @@ -153,6 +153,9 @@ class OperationView extends Backbone.View if paramContentTypeField obj.contentType = paramContentTypeField + if not obj.data + obj.contentType = false + responseContentTypeField = $('.content > .content-type > div > select[name=contentType]', $(@el)).val() if responseContentTypeField obj.headers = if obj.headers? then obj.headers else {}