@@ -53,6 +53,8 @@ data XhrRequestConfig
5353
5454data XhrResponse
5555 = XhrResponse { _xhrResponse_body :: Maybe Text
56+ , _xhrResponse_status :: Word
57+ , _xhrResponse_statusText :: Text
5658 }
5759 deriving (Show, Read, Eq, Ord, Typeable)
5860
@@ -86,10 +88,12 @@ newXMLHttpRequest req cb = do
8688 maybe (return ()) (xmlHttpRequestSetResponseType xhr . toResponseType) (_xhrRequestConfig_responseType c)
8789 _ <- xmlHttpRequestOnreadystatechange xhr $ do
8890 readyState <- liftIO $ xmlHttpRequestGetReadyState xhr
91+ status <- liftIO $ xmlHttpRequestGetStatus xhr
92+ statusText <- liftIO $ xmlHttpRequestGetStatusText xhr
8993 if readyState == 4
9094 then do
9195 r <- liftIO $ xmlHttpRequestGetResponseText xhr
92− _ <- liftIO $ postGui $ cb $ XhrResponse $ responseTextToText r
96+ _ <- liftIO $ postGui $ cb $ XhrResponse (responseTextToText r) status (statusTextToText statusText)
9397 return ()
9498 else return ()
9599 _ <- xmlHttpRequestSend xhr (_xhrRequestConfig_sendData c)