Prepend trailing slash to empty request path

This commit is contained in:
M Farkas-Dyck 2017-07-20 12:50:37 -08:00
parent 265b4276db
commit 2d76a6e771

View file

@ -29,6 +29,7 @@ import Control.Monad.Reader
import Control.Monad.Trans.Control (MonadBaseControl (..))
import qualified Data.ByteString.Builder as BS
import Data.ByteString.Lazy hiding (pack, filter, map, null, elem, any)
import qualified Data.ByteString.Lazy as BS
import Data.String
import Data.String.Conversions (cs)
import Data.Proxy
@ -162,7 +163,9 @@ reqToRequest req (BaseUrl reqScheme reqHost reqPort path) =
}
, uriPath = fullPath
}
fullPath = path ++ cs (BS.toLazyByteString (reqPath req))
fullPath = path ++ cs (slashIfNull $ BS.toLazyByteString (reqPath req))
where slashIfNull s | BS.null s = "/"
| otherwise = s
setrqb r = case reqBody req of
Nothing -> r