We are doing some pass-through requests in our application, where we make a request to S3 and then stream the response back to the client. We want to provide Content-Length headers, since S3 gives us those.
ContentSource only has the ConduitT, and does not provide a way to set the length, even when we know it.
We can provide this with a backwards-compatible pattern synonym and new constructor on Content.
data Content
= ContentSourceWithLength !(Conduit () (Flush BB.Builder) (ResourceT IO) ()) !(Maybe Int)
| etc
pattern ContentSource c <- ContentSourceWithLength c _ where
ContentSource c = ContentSourceWithLength c Nothing