atlassian-connect-core 0.5.1.0 → 0.6.0.0
raw patch · 2 files changed
+8/−3 lines, 2 filesdep +http-client-tlsPVP ok
version bump matches the API change (PVP)
Dependencies added: http-client-tls
API changes (from Hackage documentation)
Files
atlassian-connect-core.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.5.1.0+version: 0.6.0.0 -- A short (one-line) description of the package. synopsis: Atlassian Connect snaplet for the Snap Framework and helper code.@@ -112,6 +112,7 @@ , time-units == 1.* , transformers >= 0.3 && < 0.5 , http-client == 0.4.*+ , http-client-tls == 0.2.* , http-types == 0.8.* , network-api-support == 0.2.* , cryptohash == 0.11.*
src/Snap/AtlassianConnect/HostRequest.hs view
@@ -48,6 +48,7 @@ import qualified Data.ByteString.Char8 as BC import qualified Data.ByteString.Lazy as BL import Data.Connect.Descriptor as CD+import Data.List (isPrefixOf) import qualified Data.Map as M import Data.Monoid import qualified Data.Text as T@@ -58,6 +59,7 @@ import GHC.Generics import Network.Api.Support import Network.HTTP.Client+import Network.HTTP.Client.TLS (tlsManagerSettings) import Network.HTTP.Types import Network.URI import qualified Snap.AtlassianConnect.Data as AC@@ -104,7 +106,7 @@ pluginKey' <- fmap (CD.pluginKey . AC.connectPlugin) get case generateJWTToken pluginKey' currentTime (AC.sharedSecret tenant) standardHttpMethod productBaseUrl url of Nothing -> return . Left $ ProductErrorResponse 500 "Failed to generate a JWT token to make the request. The request was never made: server error."- (Just signature) -> MI.liftIO $ runRequest defaultManagerSettings standardHttpMethod url+ (Just signature) -> MI.liftIO $ runRequest connectionManagerSettings standardHttpMethod url ( addHeader ("Accept","application/json") <> addHeader ("Authorization", jwtPrefix `B.append` T.encodeUtf8 signature) <> requestModifications@@ -114,6 +116,8 @@ jwtPrefix :: B.ByteString jwtPrefix = BC.pack "JWT " + connectionManagerSettings = if "https://" `isPrefixOf` productBaseUrlString then tlsManagerSettings else defaultManagerSettings+ url = T.decodeUtf8 $ BC.pack productBaseUrlString `B.append` productRelativeUrl `B.append` renderQuery True queryParams productBaseUrlString = show productBaseUrl productBaseUrl = AC.getURI . AC.baseUrl $ tenant@@ -143,7 +147,7 @@ expiryPeriod = 1 responder :: FromJSON a => Int -> BL.ByteString -> Either ProductErrorResponse a-responder responseCode body +responder responseCode body | 200 <= responseCode && responseCode < 300 = case eitherDecode body of Right jsonResponse -> Right jsonResponse