Skip to content
This repository
Browse code

Fixed cross domain issue when setting content type

- Also fixed jsonp fail issues

#947, #1745
  • Loading branch information...
commit 439a4f60cfa2f3352392b3bfaa497c72fe9fbe8f 1 parent 4660ede
N. Taylor Mullen NTaylorMullen authored NTaylorMullen committed
6 src/Microsoft.AspNet.SignalR.Client.JS/jquery.signalR.core.js
@@ -224,6 +224,8 @@
224 224
225 225 ajaxDataType: "json",
226 226
  227 + contentType: "application/json; charset=UTF-8",
  228 +
227 229 logging: false,
228 230
229 231 state: signalR.connectionState.disconnected,
@@ -330,6 +332,8 @@
330 332 connection.log("Using jsonp because this browser doesn't support CORS");
331 333 }
332 334 }
  335 +
  336 + connection.contentType = "application/x-www-form-urlencoded; charset=UTF-8";
333 337 }
334 338
335 339 connection.ajaxDataType = config.jsonp ? "jsonp" : "json";
@@ -395,7 +399,7 @@
395 399 global: false,
396 400 cache: false,
397 401 type: "GET",
398   - contentType: "application/json; charset=UTF-8",
  402 + contentType: connection.contentType,
399 403 data: {},
400 404 dataType: connection.ajaxDataType,
401 405 error: function (error) {
6 src/Microsoft.AspNet.SignalR.Client.JS/jquery.signalR.transports.common.js
@@ -75,7 +75,7 @@
75 75 global: false,
76 76 cache: false,
77 77 type: "GET",
78   - contentType: "application/json; charset=UTF-8",
  78 + contentType: connection.contentType,
79 79 data: {},
80 80 dataType: connection.ajaxDataType,
81 81 success: function (data) {
@@ -173,7 +173,7 @@
173 173 url: url,
174 174 global: false,
175 175 type: connection.ajaxDataType === "jsonp" ? "GET" : "POST",
176   - contentType: connection.ajaxDataType === "jsonp" ? "text/html; charset=UTF-8" : "application/x-www-form-urlencoded; charset=UTF-8",
  176 + contentType: "application/x-www-form-urlencoded; charset=UTF-8",
177 177 dataType: connection.ajaxDataType,
178 178 data: {
179 179 data: data
@@ -211,7 +211,7 @@
211 211 timeout: 1000,
212 212 global: false,
213 213 type: "POST",
214   - contentType: "application/json; charset=UTF-8",
  214 + contentType: connection.contentType,
215 215 dataType: connection.ajaxDataType,
216 216 data: {}
217 217 });
1  src/Microsoft.AspNet.SignalR.Client.JS/jquery.signalR.transports.longPolling.js
@@ -86,6 +86,7 @@
86 86 cache: false,
87 87 type: "GET",
88 88 dataType: connection.ajaxDataType,
  89 + contentType: connection.contentType,
89 90 success: function (minData) {
90 91 var delay = 0,
91 92 data;

0 comments on commit 439a4f6

Please sign in to comment.
Something went wrong with that request. Please try again.