                 "text"
             else if responseBodyType == "json"
                 "text"
-            else
-                reject(new Error("error")); return
         xhr.timeout = timeout ? 0
         xhr.onload = ->
             response =

                                data.toString()
                            else if responseBodyType == "json"
                                JSON.parse(data.toString())
                            else
                                reject(new Error("error")); return
                    if (200 <= response.statusCode < 300)
                        resolve(response)
                    else

    responseBodyType = options.responseBodyType ? "text"
    if body? and typeof body != "string" and body not instanceof Uint8Array
        reject(new Error("error")); return
    if responseBodyType not in ["binary", "text", "json"]
        reject(new Error("error")); return
    if mate.environmentType == "browser" then do ->
        xhr = new XMLHttpRequest()
        xhr.open(method, url)
