warp-grpc 0.4.0.0 → 0.4.0.1
raw patch · 3 files changed
+16/−13 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- src/Network/GRPC/Server/Wai.hs +10/−11
- warp-grpc.cabal +2/−2
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for warp-grpc +## 0.4.0.1++Add the `grpc-encoding` header to the response ([#20](https://github.com/haskell-grpc-native/http2-grpc-haskell/pull/20)).+ ## 0.4.0.0 Support for handlers in transformers stacks, and in monads which support [`unliftio`](http://hackage.haskell.org/package/unliftio).
src/Network/GRPC/Server/Wai.hs view
@@ -95,12 +95,19 @@ , Handler $ \(e::SomeException) -> modifyGRPCStatus r req (GRPCStatus INTERNAL $ ByteString.pack $ show e) ]- in (rep $ responseStream status200 hdrs200 grpcHandler)+ in (rep $ responseStream status200 (hdrs200 req) grpcHandler) Nothing -> app req rep where- hdrs200 = [+ bestCompression req = lookupEncoding req compressions+ pickedCompression req = fromMaybe (Encoding uncompressed) (bestCompression req)++ hopefulDecompression req = lookupDecoding req compressions+ pickedDecompression req = fromMaybe (Decoding uncompressed) (hopefulDecompression req)++ hdrs200 req = [ ("content-type", grpcContentTypeHV)+ , ("grpc-encoding", grpcCompressionHV (_getEncodingCompression $ pickedCompression req)) , ("trailer", CI.original grpcStatusH) , ("trailer", CI.original grpcMessageH) ]@@ -108,15 +115,7 @@ lookupHandler p plainHandlers = grpcWaiHandler <$> List.find (\(ServiceHandler rpcPath _) -> rpcPath == p) plainHandlers doHandle r handler req write flush = do- let bestCompression = lookupEncoding req compressions- let pickedCompression = fromMaybe (Encoding uncompressed) bestCompression-- let hopefulDecompression = lookupDecoding req compressions- let pickedDecompression = fromMaybe (Decoding uncompressed) hopefulDecompression-- putStrLn "running handler"- _ <- handler pickedDecompression pickedCompression req write flush- putStrLn "setting GRPC status"+ _ <- handler (pickedDecompression req) (pickedCompression req) req write flush modifyGRPCStatus r req (GRPCStatus OK "WAI handler ended.") #if MIN_VERSION_warp(3,3,0)
warp-grpc.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: e655a88509754d2322f32ede1f4ca7a39ab5ba25b54ef1d9f2e79ad6521ec110+-- hash: 66d2a5fc66e9ca521d6751543a4205c207099d1cf7ace8c6fb84adc55cc1f32a name: warp-grpc-version: 0.4.0.0+version: 0.4.0.1 synopsis: A minimal gRPC server on top of Warp. description: Please see the README on Github at <https://github.com/haskell-grpc-native/http2-grpc-haskell/blob/master/warp-grpc/README.md> category: Networking