File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,7 @@ import Servant.API.Stream
178
178
import Servant.API.Sub
179
179
(type (:> ))
180
180
import Servant.API.TypeLevel
181
+ import Servant.API.UVerb
181
182
import Servant.API.Vault
182
183
(Vault )
183
184
import Servant.API.Verbs
@@ -576,6 +577,11 @@ instance HasLink (Stream m status fr ct a) where
576
577
type MkLink (Stream m status fr ct a ) r = r
577
578
toLink toA _ = toA
578
579
580
+ -- UVerb instances
581
+ instance HasLink (UVerb m ct a ) where
582
+ type MkLink (UVerb m ct a ) r = r
583
+ toLink toA _ = toA
584
+
579
585
-- AuthProtext instances
580
586
instance HasLink sub => HasLink (AuthProtect tag :> sub ) where
581
587
type MkLink (AuthProtect tag :> sub ) a = MkLink sub a
Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ type TestApi =
29
29
-- Fragment
30
30
:<|> " say" :> Fragment String :> Get '[JSON ] NoContent
31
31
32
+ -- UVerb
33
+ :<|> " uverb-example" :> UVerb 'GET '[JSON ] '[WithStatus 200 NoContent ]
34
+
32
35
-- All of the verbs
33
36
:<|> " get" :> Get '[JSON ] NoContent
34
37
:<|> " put" :> Put '[JSON ] NoContent
@@ -73,6 +76,10 @@ spec = describe "Servant.Links" $ do
73
76
[" roads" , " lead" , " to" , " rome" ]
74
77
`shouldBeLink` " all/roads/lead/to/rome"
75
78
79
+ it " generated correct links for UVerbs" $ do
80
+ apiLink (Proxy :: Proxy (" uverb-example" :> UVerb 'GET '[JSON ] '[WithStatus 200 NoContent ]))
81
+ `shouldBeLink` " uverb-example"
82
+
76
83
it " generates correct links for query flags" $ do
77
84
let l1 = Proxy :: Proxy (" balls" :> QueryFlag " bouncy"
78
85
:> QueryFlag " fast" :> Delete '[JSON ] NoContent )
You can’t perform that action at this time.
0 commit comments