Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions cardano-db-sync/src/Cardano/DbSync/OffChain/Http.hs
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,19 @@ isPossiblyJsonObject bs =
-------------------------------------------------------------------------------------
parseOffChainUrl :: OffChainUrlType -> ExceptT OffChainFetchError IO Http.Request
parseOffChainUrl url =
handleExceptT wrapHttpException $ applyContentType <$> Http.parseRequest (showUrl url)
handleExceptT wrapHttpException $ applyHeaders <$> Http.parseRequest (showUrl url)
where
wrapHttpException :: HttpException -> OffChainFetchError
wrapHttpException err = OCFErrHttpException url (textShow err)

applyContentType :: Http.Request -> Http.Request
applyContentType req =
applyHeaders :: Http.Request -> Http.Request
applyHeaders req =
req
{ Http.requestHeaders =
Http.requestHeaders req ++ [(CI.mk "content-type", "application/json")]
Http.requestHeaders req
++ [ (CI.mk "content-type", "application/json")
, (CI.mk "user-agent", "cardano-db-sync")
]
}

-------------------------------------------------------------------------------------
Expand Down
Loading