Use BaseUrl and Req instead of Request.
This commit is contained in:
parent
bf9c84eccb
commit
29c9d85ade
1 changed files with 7 additions and 2 deletions
|
@ -48,7 +48,7 @@ import Web.HttpApiData
|
|||
|
||||
data ServantError
|
||||
= FailureResponse
|
||||
{ failingRequest :: Request
|
||||
{ failingRequest :: UrlReq
|
||||
, responseStatus :: Status
|
||||
, responseContentType :: MediaType
|
||||
, responseBody :: ByteString
|
||||
|
@ -86,6 +86,11 @@ instance Eq ServantError where
|
|||
|
||||
instance Exception ServantError
|
||||
|
||||
data UrlReq = UrlReq BaseUrl Req
|
||||
|
||||
instance Show UrlReq where
|
||||
show (UrlReq url req) = showBaseUrl url ++ reqPath req ++ "?" ++ show (qs req)
|
||||
|
||||
data Req = Req
|
||||
{ reqPath :: String
|
||||
, qs :: QueryText
|
||||
|
@ -251,7 +256,7 @@ performRequest reqMethod req = do
|
|||
Nothing -> throwError $ InvalidContentTypeHeader (cs t) body
|
||||
Just t' -> pure t'
|
||||
unless (status_code >= 200 && status_code < 300) $
|
||||
throwError $ FailureResponse request status ct body
|
||||
throwError $ FailureResponse (UrlReq reqHost req) status ct body
|
||||
return (status_code, body, ct, hdrs, response)
|
||||
|
||||
performRequestCT :: MimeUnrender ct result => Proxy ct -> Method -> Req
|
||||
|
|
Loading…
Reference in a new issue