forked from erikd/http-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test.Gen: Generate a Wai.Request instead of a Proxy Request
The proxy receives a Wai.Request, converts it to the proxy's own Request type, potentially modifies it and then converts it back to a Wai.Request. However, the conversion from a Wai.Request to a proxy Request is lossy so that when we do a conversion of Wai.Request to proxy Request and then back to a Wai.Request we copy the unchanged fields from the original to the destination.
- Loading branch information
Showing
6 changed files
with
84 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
------------------------------------------------------------ | ||
-- Copyright : Erik de Castro Lopo <[email protected]> | ||
-- License : BSD3 | ||
------------------------------------------------------------ | ||
|
||
module Test.Wai where | ||
|
||
import Network.Wai.Internal | ||
import Test.Hspec | ||
|
||
waiShouldBe :: Request -> Request -> Expectation | ||
waiShouldBe a b = do | ||
requestMethod a `shouldBe` requestMethod b | ||
httpVersion a `shouldBe` httpVersion b | ||
rawPathInfo a `shouldBe` rawPathInfo b | ||
rawQueryString a `shouldBe` rawQueryString b | ||
requestHeaders a `shouldBe` requestHeaders b | ||
isSecure a `shouldBe` isSecure b | ||
remoteHost a `shouldBe` remoteHost b | ||
pathInfo a `shouldBe` pathInfo b | ||
queryString a `shouldBe` queryString b | ||
-- requestBody a | ||
-- vault a `shouldBe` vault b | ||
-- requestBodyLength a `shouldBe` requestBodyLength b | ||
requestHeaderHost a `shouldBe` requestHeaderHost b | ||
requestHeaderRange a `shouldBe` requestHeaderRange b | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,7 @@ Test-Suite testsuite | |
, random >= 1.1 | ||
, resourcet | ||
, text | ||
, vault | ||
, wai | ||
, wai-conduit | ||
, warp | ||
|