| Safe Haskell | None |
|---|
Network.HTTP.Toolkit.Response
- data Response a = Response {
- responseStatus :: Status
- responseHeaders :: [Header]
- responseBody :: a
- readResponse :: Method -> Connection -> IO (Response BodyReader)
- readResponseWithLimit :: Limit -> Method -> Connection -> IO (Response BodyReader)
- parseStatusLine :: ByteString -> Maybe Status
- sendResponse :: (ByteString -> IO ()) -> Response BodyReader -> IO ()
- formatStatusLine :: Status -> ByteString
- determineResponseBodyType :: Method -> Status -> [Header] -> BodyType
Documentation
Constructors
| Response | |
Fields
| |
readResponse :: Method -> Connection -> IO (Response BodyReader)Source
Same as readResponseWithLimit with a Limit of
defaultHeaderSizeLimit.
readResponseWithLimit :: Limit -> Method -> Connection -> IO (Response BodyReader)Source
Read response from provided connection.
The corresponding request Method has to be specified so that the body length can be determined (see
RFC 2616, Section 4.4).
Throws:
-
InvalidStatusLineif status-line is malformed. -
HeaderTooLargeif status-line and headers together exceed the specified sizeLimit -
InvalidHeaderif status-line is missing or a header is malformed
parseStatusLine :: ByteString -> Maybe StatusSource
Parse status-line (see RFC 2616, Section 6.1).
sendResponse :: (ByteString -> IO ()) -> Response BodyReader -> IO ()Source
Send an HTTP response.
formatStatusLine :: Status -> ByteStringSource
Format status-line.
determineResponseBodyType :: Method -> Status -> [Header] -> BodyTypeSource
Determine the message BodyType from a given Method, Status, and list
of message headers (as of
RFC 2616, Section 4.4).