Closed domenkozar closed 6 years ago
Ah, had an issue in the test case, now it correctly reproduces:
hello.txt: hGetBufSome: illegal operation (handle is closed)
streams a huge file as response body FAILED [1]
Failures:
test/Servant/Streaming/ServerSpec.hs:100:
1) Servant.Streaming.Server, StreamResponse instance, streams a huge file as response body
uncaught exception: HttpException (HttpExceptionRequest Request {
host = "localhost"
port = 33951
secure = False
requestHeaders = [("Content-Type","application/json")]
path = "getfile"
queryString = ""
method = "POST"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutNone
requestVersion = HTTP/1.1
}
NoResponseDataReceived)
I've used @edsko snippet from https://github.com/haskell-servant/servant/issues/271#issuecomment-258079285 and tests pass locally.
(still need to make sure hello.txt
gets deleted at the end of the test)
Ah, I spent some time looking into this, but would not have thought of this solution. (I think I still don't have a good mental model for ResourceT
). Thank you so much!
(There's a separate issue that's causing the CI failure that I'll fix)
In tests I don't see the output, but with an example serving the API I also see:
cc @jkarni this is a test case for what we discussed yesterday on #servant