Merge pull request #22 from Fuuzetsu/accepted-codes

Accept wider range of return codes
This commit is contained in:
Julian Arni 2015-03-25 18:50:08 +01:00
commit ac733be7f2

View file

@ -111,7 +111,7 @@ instance HasClient Delete where
type Client Delete = BaseUrl -> EitherT ServantError IO () type Client Delete = BaseUrl -> EitherT ServantError IO ()
clientWithRoute Proxy req host = clientWithRoute Proxy req host =
void $ performRequest H.methodDelete req (== 204) host void $ performRequest H.methodDelete req (`elem` [200, 202, 204]) host
-- | If you have a 'Get' endpoint in your API, the client -- | If you have a 'Get' endpoint in your API, the client
-- side querying function that is created when calling 'client' -- side querying function that is created when calling 'client'
@ -120,7 +120,7 @@ instance HasClient Delete where
instance (MimeUnrender ct result) => HasClient (Get (ct ': cts) result) where instance (MimeUnrender ct result) => HasClient (Get (ct ': cts) result) where
type Client (Get (ct ': cts) result) = BaseUrl -> EitherT ServantError IO result type Client (Get (ct ': cts) result) = BaseUrl -> EitherT ServantError IO result
clientWithRoute Proxy req host = clientWithRoute Proxy req host =
performRequestCT (Proxy :: Proxy ct) H.methodGet req [200] host performRequestCT (Proxy :: Proxy ct) H.methodGet req [200, 203] host
-- | If you use a 'Header' in one of your endpoints in your API, -- | If you use a 'Header' in one of your endpoints in your API,
-- the corresponding querying function will automatically take -- the corresponding querying function will automatically take