No need to set content type for requests without body

This commit is contained in:
Piotr Sarnacki 2013-01-29 04:16:19 +01:00
parent a8fb681bfc
commit ba2f691ae6

View File

@ -23,12 +23,14 @@ jQuery.support.cors = true
options.url = "#{endpoint}#{url}"
options.type = method
options.dataType = options.dataType || 'json'
options.contentType = options.contentType || 'application/json; charset=utf-8'
options.context = this
if options.data && method != 'GET'
options.data = JSON.stringify(options.data)
if method != 'GET' && method != 'HEAD'
options.contentType = options.contentType || 'application/json; charset=utf-8'
success = options.success || (->)
options.success = (data) =>
Travis.app.router.flashController.loadFlashes(data.flash) if Travis.app?.router && data.flash