Skip to content

Commit

Permalink
use NgxExportService type synonym in tests for subrequests
Browse files Browse the repository at this point in the history
  • Loading branch information
lyokha committed Feb 17, 2024
1 parent 6654c0d commit 18a64de
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion NgxExport/Tools/Resolve.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : NgxExport.Tools.Resolve
-- Copyright : (c) Alexey Radkov 2022-2023
-- Copyright : (c) Alexey Radkov 2022-2024
-- License : BSD-style
--
-- Maintainer : alexey.radkov@gmail.com
Expand Down
4 changes: 2 additions & 2 deletions NgxExport/Tools/Subrequest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ import System.IO.Unsafe
-- import Data.ByteString (ByteString)
-- import qualified Data.ByteString.Lazy as L
--
-- makeRequest :: ByteString -> Bool -> IO L.ByteString
-- makeRequest :: ByteString -> 'NgxExportService'
-- __/makeRequest/__ = const . 'makeSubrequest'
--
-- 'ngxExportSimpleService' \'makeRequest $ 'PersistentService' $ Just $ 'Sec' 10
Expand Down Expand Up @@ -545,7 +545,7 @@ ngxExportSimpleServiceTyped 'configureUDS ''UDSConf SingleShotService
-- import qualified Network.Socket.ByteString as SB
-- import qualified Data.ByteString.Char8 as C8
--
-- configureUdsManager :: ByteString -> Bool -> IO L.ByteString
-- configureUdsManager :: ByteString -> 'NgxExportService'
-- __/configureUdsManager/__ = 'ignitionService' $ \\path -> 'voidHandler' $ do
-- man <- newManager defaultManagerSettings
-- { managerRawConnection = return $ openUDS path }
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ import NgxExport.Tools.Subrequest
import Data.ByteString (ByteString)
import qualified Data.ByteString.Lazy as L

makeRequest :: ByteString -> Bool -> IO L.ByteString
makeRequest :: ByteString -> NgxExportService
makeRequest = const . makeSubrequest

ngxExportSimpleService 'makeRequest $ PersistentService $ Just $ Sec 10
Expand Down Expand Up @@ -2073,7 +2073,7 @@ import qualified Network.Socket as S
import qualified Network.Socket.ByteString as SB
import qualified Data.ByteString.Char8 as C8

configureUdsManager :: ByteString -> Bool -> IO L.ByteString
configureUdsManager :: ByteString -> NgxExportService
configureUdsManager = ignitionService $ \path -> voidHandler $ do
man <- newManager defaultManagerSettings
{ managerRawConnection = return $ openUDS path }
Expand Down
2 changes: 1 addition & 1 deletion test/Subrequest/test-tools-extra-subrequest.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ library
default-language: Haskell2010
build-depends: base >= 4.8 && < 5
, ngx-export
, ngx-export-tools
, ngx-export-tools >= 1.2.2
, ngx-export-tools-extra
, bytestring
, http-client
Expand Down
14 changes: 7 additions & 7 deletions test/Subrequest/test_tools_extra_subrequest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ import qualified Network.Socket as S
import qualified Network.Socket.ByteString as SB
import qualified Data.ByteString.Char8 as C8

makeRequest :: ByteString -> Bool -> IO L.ByteString
makeRequest :: ByteString -> NgxExportService
makeRequest = const . makeSubrequest

ngxExportSimpleService 'makeRequest $ PersistentService $ Just $ Sec 10

reqBody :: L.ByteString -> ByteString -> IO L.ByteString
reqBody = const . return

ngxExportAsyncOnReqBody 'reqBody

configureUdsManager :: ByteString -> Bool -> IO L.ByteString
configureUdsManager :: ByteString -> NgxExportService
configureUdsManager = ignitionService $ \path -> voidHandler $ do
man <- newManager defaultManagerSettings
{ managerRawConnection = return $ openUDS path }
Expand All @@ -36,3 +31,8 @@ configureUdsManager = ignitionService $ \path -> voidHandler $ do

ngxExportSimpleService 'configureUdsManager SingleShotService

reqBody :: L.ByteString -> ByteString -> IO L.ByteString
reqBody = const . return

ngxExportAsyncOnReqBody 'reqBody

0 comments on commit 18a64de

Please sign in to comment.