       )
     else
       Toast.error(error)
-      Promise.reject(error)
+
+
+  handleEmptyJsonResponse : (response) ->
+
+    contentLength = parseInt(response.headers.get("Content-Length"))
+    if contentLength == 0
+      Promise.resolve({})
+    else
+      response.json()
 
 
   # Extends the native Promise API with `always` functionality similar to jQuery.

        body : if typeof(data) == "string" then data else data.serialize()
        headers :
          "Content-Type" : "application/x-www-form-urlencoded"
      (response) ->
        response.json()
    )




        method : "POST"
        body : formData
      @handleEmptyJsonResponse
    )


