I’m trying to get the response code (200,404 etc) from i THINK a Response type in the HTTP class with simpleHTTP
Thus far:
--how to get the http response Int from response
getStatusCode response = print 0
--this works...
--- othercode ---
rsp <- simpleHTTP (defaultGETRequest_ clean_uri)
file_buffer <- getResponseBody(rsp)
--this fails
response = (getStatusCode rsp)
I think what you want is
from the
Network.HTTPmodule if you’re using HTTP-4000.2.4 or later. For earlier versions ofHTTP, you would have to pattern-match yourself on therspCodefield apparently, similar to the way shown below for therspReasonfield.If you are interested in the reason, use the
rspReasonfield ofResponse, afteryou have
and can access the reason per