scala-js/scala-js-dom

Ajax considers 304 (content not modified) an error

matthughes opened this issue · 0 comments

The Ajax extension is too strict in what it considers failures:

    req.onreadystatechange = {(e: dom.Event) =>
      if (req.readyState.toInt == 4){
        if (200 <= req.status && req.status < 300)
          promise.success(req)
        else
          promise.failure(AjaxException(req))
      }
    }

304 is a valid response and should not be considered an error.