File tree Expand file tree Collapse file tree 6 files changed +27
-2
lines changed
servant-client/src/Servant
servant-docs/src/Servant/Docs
servant-foreign/src/Servant/Foreign
servant-server/test/Servant
servant/src/Servant/API/Internal/Test Expand file tree Collapse file tree 6 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -417,6 +417,12 @@ instance HasClient api => HasClient (IsSecure :> api) where
417
417
clientWithRoute Proxy req baseurl manager =
418
418
clientWithRoute (Proxy :: Proxy api ) req baseurl manager
419
419
420
+ instance HasClient subapi =>
421
+ HasClient (WithNamedConfig name config subapi ) where
422
+
423
+ type Client (WithNamedConfig name config subapi ) = Client subapi
424
+ clientWithRoute Proxy = clientWithRoute (Proxy :: Proxy subapi )
425
+
420
426
421
427
{- Note [Non-Empty Content Types]
422
428
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Original file line number Diff line number Diff line change @@ -794,6 +794,9 @@ instance HasDocs sublayout => HasDocs (Vault :> sublayout) where
794
794
docsFor Proxy ep =
795
795
docsFor (Proxy :: Proxy sublayout ) ep
796
796
797
+ instance HasDocs sublayout => HasDocs (WithNamedConfig name config sublayout ) where
798
+ docsFor Proxy = docsFor (Proxy :: Proxy sublayout )
799
+
797
800
-- ToSample instances for simple types
798
801
instance ToSample ()
799
802
instance ToSample Bool
Original file line number Diff line number Diff line change @@ -295,6 +295,13 @@ instance HasForeign lang sublayout => HasForeign lang (Vault :> sublayout) where
295
295
foreignFor lang Proxy req =
296
296
foreignFor lang (Proxy :: Proxy sublayout ) req
297
297
298
+ instance HasForeign lang sublayout =>
299
+ HasForeign lang (WithNamedConfig name config sublayout ) where
300
+
301
+ type Foreign (WithNamedConfig name config sublayout ) = Foreign sublayout
302
+
303
+ foreignFor lang Proxy = foreignFor lang (Proxy :: Proxy sublayout )
304
+
298
305
instance HasForeign lang sublayout => HasForeign lang (HttpVersion :> sublayout ) where
299
306
type Foreign (HttpVersion :> sublayout ) = Foreign sublayout
300
307
Original file line number Diff line number Diff line change @@ -160,6 +160,9 @@ instance HasMock Raw where
160
160
161
161
where genBody = pack <$> generate (vector 100 :: Gen [Char ])
162
162
163
+ instance HasMock rest => HasMock (WithNamedConfig name config rest ) where
164
+ mock _ = mock (Proxy :: Proxy rest )
165
+
163
166
mockArbitrary :: (MonadIO m , Arbitrary a ) => m a
164
167
mockArbitrary = liftIO (generate arbitrary)
165
168
Original file line number Diff line number Diff line change @@ -60,11 +60,16 @@ import Servant.Server.Internal.RoutingApplication
60
60
import Servant.Server.Internal.Router
61
61
(tweakResponse , runRouter ,
62
62
Router , Router' (LeafRouter ))
63
+ import Servant.Server.Internal.Config
64
+ (Config (.. ), NamedConfig (.. ))
63
65
64
66
-- * comprehensive api test
65
67
66
68
-- This declaration simply checks that all instances are in place.
67
- _ = serve comprehensiveAPI
69
+ _ = serve comprehensiveAPI comprehensiveApiConfig
70
+
71
+ comprehensiveApiConfig :: Config '[NamedConfig " foo" '[] ]
72
+ comprehensiveApiConfig = NamedConfig EmptyConfig :. EmptyConfig
68
73
69
74
-- * Specs
70
75
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ type ComprehensiveAPI =
29
29
" foo" :> GET :<|>
30
30
Vault :> GET :<|>
31
31
Verb 'POST 204 '[JSON ] () :<|>
32
- Verb 'POST 204 '[JSON ] Int
32
+ Verb 'POST 204 '[JSON ] Int :<|>
33
+ WithNamedConfig " foo" '[] GET
33
34
34
35
comprehensiveAPI :: Proxy ComprehensiveAPI
35
36
comprehensiveAPI = Proxy
You can’t perform that action at this time.
0 commit comments