mirror of
https://github.com/haskell-servant/servant-ekg.git
synced 2024-11-26 04:59:43 +01:00
Merge pull request #32 from Simspace/uverb+fragment-support
support UVerb + correctly bound Fragment instance for older servant versions
This commit is contained in:
commit
a5ef9c5efd
2 changed files with 22 additions and 9 deletions
|
@ -117,9 +117,11 @@ instance HasEndpoint (sub :: *) => HasEndpoint (Header' mods h a :> sub) where
|
||||||
getEndpoint _ = getEndpoint (Proxy :: Proxy sub)
|
getEndpoint _ = getEndpoint (Proxy :: Proxy sub)
|
||||||
enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub)
|
enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub)
|
||||||
|
|
||||||
|
#if MIN_VERSION_servant(0,18,2)
|
||||||
instance HasEndpoint (sub :: *) => HasEndpoint (Fragment a :> sub) where
|
instance HasEndpoint (sub :: *) => HasEndpoint (Fragment a :> sub) where
|
||||||
getEndpoint _ = getEndpoint (Proxy :: Proxy sub)
|
getEndpoint _ = getEndpoint (Proxy :: Proxy sub)
|
||||||
enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub)
|
enumerateEndpoints _ = enumerateEndpoints (Proxy :: Proxy sub)
|
||||||
|
#endif
|
||||||
|
|
||||||
instance HasEndpoint (sub :: *) => HasEndpoint (QueryParam' mods (h :: Symbol) a :> sub) where
|
instance HasEndpoint (sub :: *) => HasEndpoint (QueryParam' mods (h :: Symbol) a :> sub) where
|
||||||
getEndpoint _ = getEndpoint (Proxy :: Proxy sub)
|
getEndpoint _ = getEndpoint (Proxy :: Proxy sub)
|
||||||
|
@ -183,6 +185,17 @@ instance ReflectMethod method => HasEndpoint (NoContentVerb method) where
|
||||||
where method = reflectMethod (Proxy :: Proxy method)
|
where method = reflectMethod (Proxy :: Proxy method)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MIN_VERSION_servant(0,18,1)
|
||||||
|
instance ReflectMethod method => HasEndpoint (UVerb method contentType as) where
|
||||||
|
getEndpoint _ req = case pathInfo req of
|
||||||
|
[] | requestMethod req == method -> Just (APIEndpoint [] method)
|
||||||
|
_ -> Nothing
|
||||||
|
where method = reflectMethod (Proxy :: Proxy method)
|
||||||
|
|
||||||
|
enumerateEndpoints _ = [APIEndpoint mempty method]
|
||||||
|
where method = reflectMethod (Proxy :: Proxy method)
|
||||||
|
#endif
|
||||||
|
|
||||||
instance ReflectMethod method => HasEndpoint (Stream method status framing ct a) where
|
instance ReflectMethod method => HasEndpoint (Stream method status framing ct a) where
|
||||||
getEndpoint _ req = case pathInfo req of
|
getEndpoint _ req = case pathInfo req of
|
||||||
[] | requestMethod req == method -> Just (APIEndpoint [] method)
|
[] | requestMethod req == method -> Just (APIEndpoint [] method)
|
||||||
|
|
|
@ -25,15 +25,15 @@ library
|
||||||
other-modules: Servant.Ekg.Internal
|
other-modules: Servant.Ekg.Internal
|
||||||
hs-source-dirs: lib
|
hs-source-dirs: lib
|
||||||
build-depends:
|
build-depends:
|
||||||
base >=4.9 && <4.15
|
base >=4.9 && <4.16
|
||||||
, ekg-core >=0.1.1.4 && <0.2
|
, ekg-core >=0.1.1.4 && <0.2
|
||||||
, http-types >=0.12.2 && <0.13
|
, http-types >=0.12.2 && <0.13
|
||||||
, hashable >=1.2.7.0 && <1.4
|
, hashable >=1.2.7.0 && <1.4
|
||||||
, servant >=0.14 && <0.20
|
, servant >=0.14 && <0.20
|
||||||
, text >=1.2.3.0 && <1.3
|
, text >=1.2.3.0 && <1.3
|
||||||
, time >=1.6.0.1 && <1.12
|
, time >=1.6.0.1 && <1.12
|
||||||
, unordered-containers >=0.2.9.0 && <0.3
|
, unordered-containers >=0.2.9.0 && <0.3
|
||||||
, wai >=3.2.0 && <3.3
|
, wai >=3.2.0 && <3.3
|
||||||
|
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue