Skip to content

Commit

Permalink
remove HTTPRegistrar interface in preference of Registrar
Browse files Browse the repository at this point in the history
  • Loading branch information
algorandskiy committed Jul 26, 2024
1 parent 3d8ce8b commit cddb78e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 1 addition & 7 deletions rpcs/blockService.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,8 @@ func MakeBlockService(log logging.Logger, config config.Local, ledger LedgerForB
return service
}

// HTTPRegistrar represents an HTTP request router that can be used by BlockService
// to register its request handlers.
type HTTPRegistrar interface {
RegisterHTTPHandlerFunc(path string, handler func(response http.ResponseWriter, request *http.Request))
}

// RegisterHandlers registers the request handlers for BlockService's paths with the registrar.
func (bs *BlockService) RegisterHandlers(registrar HTTPRegistrar) {
func (bs *BlockService) RegisterHandlers(registrar Registrar) {
registrar.RegisterHTTPHandlerFunc(BlockServiceBlockPath, bs.ServeBlockPath)
}

Expand Down
2 changes: 2 additions & 0 deletions rpcs/registrar.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
type Registrar interface {
// RegisterHTTPHandler path accepts gorilla/mux path annotations
RegisterHTTPHandler(path string, handler http.Handler)
// RegisterHTTPHandlerFunc path accepts gorilla/mux path annotations and a HandlerFunc
RegisterHTTPHandlerFunc(path string, handler func(response http.ResponseWriter, request *http.Request))
// RegisterHandlers exposes global websocket handler registration
RegisterHandlers(dispatch []network.TaggedMessageHandler)
}

0 comments on commit cddb78e

Please sign in to comment.