on master help sign in
Add alias of Request for HTTP2
8574d57Andrew Pritchard
wai/Network/Wai/HTTP2.hs+8−2
@@ -11,19 +11,25 @@ module Network.Wai.HTTP2
11import Blaze.ByteString.Builder (Builder)
11import Blaze.ByteString.Builder (Builder)
12import qualified Network.HTTP.Types as H
12import qualified Network.HTTP.Types as H
13
13
14−import Network.Wai.Internal (Request)
14+import qualified Network.Wai.Internal as H1 (Request)
15
15
16-- | Headers sent after the end of a data stream, as defined by section 4.1.2 of
16-- | Headers sent after the end of a data stream, as defined by section 4.1.2 of
17-- the HTTP\/1.1 spec (RFC 7230), and section 8.1 of the HTTP\/2 spec.
17-- the HTTP\/1.1 spec (RFC 7230), and section 8.1 of the HTTP\/2 spec.
18type Trailers = H.ResponseHeaders
18type Trailers = H.ResponseHeaders
19
19
20+-- | The type of an HTTP\/2 request.
21+-- TODO(awpr): specialize this for HTTP\/2.
22+type Request = H1.Request
23+
20-- | The HTTP\/2-aware equivalent of 'Network.Wai.Application'.
24-- | The HTTP\/2-aware equivalent of 'Network.Wai.Application'.
21−type Http2Application = Request -> (forall a. Response a -> IO a) -> IO Trailers
25+type Http2Application = Request -> Responder
22
26
23type Body a = (Builder -> IO ()) -> IO () -> IO a
27type Body a = (Builder -> IO ()) -> IO () -> IO a
24
28
25type Response a = (H.Status, H.ResponseHeaders, Body a)
29type Response a = (H.Status, H.ResponseHeaders, Body a)
26
30
31+type Responder = (forall a. Response a -> IO a) -> IO Trailers
32+
27responseStatus :: Response a -> H.Status
33responseStatus :: Response a -> H.Status
28responseStatus (s, _, _) = s
34responseStatus (s, _, _) = s
29
35