Skip to content

Commit 0dab850

Browse files
committed
1974 - add user agent to offchain queries
1 parent b3fcefd commit 0dab850

File tree

1 file changed

+7
-4
lines changed
  • cardano-db-sync/src/Cardano/DbSync/OffChain

1 file changed

+7
-4
lines changed

cardano-db-sync/src/Cardano/DbSync/OffChain/Http.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,19 @@ isPossiblyJsonObject bs =
207207
-------------------------------------------------------------------------------------
208208
parseOffChainUrl :: OffChainUrlType -> ExceptT OffChainFetchError IO Http.Request
209209
parseOffChainUrl url =
210-
handleExceptT wrapHttpException $ applyContentType <$> Http.parseRequest (showUrl url)
210+
handleExceptT wrapHttpException $ applyHeaders <$> Http.parseRequest (showUrl url)
211211
where
212212
wrapHttpException :: HttpException -> OffChainFetchError
213213
wrapHttpException err = OCFErrHttpException url (textShow err)
214214

215-
applyContentType :: Http.Request -> Http.Request
216-
applyContentType req =
215+
applyHeaders :: Http.Request -> Http.Request
216+
applyHeaders req =
217217
req
218218
{ Http.requestHeaders =
219-
Http.requestHeaders req ++ [(CI.mk "content-type", "application/json")]
219+
Http.requestHeaders req
220+
++ [ (CI.mk "content-type", "application/json")
221+
, (CI.mk "user-agent", "cardano-db-sync")
222+
]
220223
}
221224

222225
-------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)