Skip to content

Commit

Permalink
add headers
Browse files Browse the repository at this point in the history
  • Loading branch information
h0ngcha0 committed Mar 19, 2021
1 parent 3c05b12 commit 3fd7adb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/scala/it/softfork/bitcoin4s/Routes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ class Routes(blockcypherService: BlockCypherService)(implicit ec: ExecutionConte
}
}

val headerRoute = {
(path("headers") & get) {
extractRequest { request =>
val headers = request.headers.map { header =>
(header.name, header.value())
}
complete(headers)
}
}
}

val transactionRoute = pathPrefix("transaction") {
pathPrefix(Segment.map(TxId.apply)) { txId =>
pathEndOrSingleSlash {
Expand Down Expand Up @@ -86,7 +97,8 @@ class Routes(blockcypherService: BlockCypherService)(implicit ec: ExecutionConte
clientRoute ~
pathPrefix("api") {
transactionRoute ~
healthRoute
healthRoute ~
headerRoute
}
}

Expand Down

0 comments on commit 3fd7adb

Please sign in to comment.