mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 22:54:17 -05:00
HTTP validator API: health endpoints (#13149)
* updating health endpoints * updating tests * updating tests * moving where the header is written and adding allow origin header * removing header * Update validator/rpc/handlers_health.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/handlers_health.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/handlers_health.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * radek's comments * Update handlers_health.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * adding the correct errors to handle error --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
9
io/logs/mock/BUILD.bazel
Normal file
9
io/logs/mock/BUILD.bazel
Normal file
@@ -0,0 +1,9 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["mock_stream.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/io/logs/mock",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//async/event:go_default_library"],
|
||||
)
|
||||
27
io/logs/mock/mock_stream.go
Normal file
27
io/logs/mock/mock_stream.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package mock
|
||||
|
||||
import "github.com/prysmaticlabs/prysm/v4/async/event"
|
||||
|
||||
type MockStreamer struct {
|
||||
logs [][]byte
|
||||
feed *event.Feed
|
||||
}
|
||||
|
||||
// NewMockStreamer creates a new instance of MockStreamer.
|
||||
// It's useful to set up the default state for the mock, like initializing the feed.
|
||||
func NewMockStreamer(logs [][]byte) *MockStreamer {
|
||||
return &MockStreamer{
|
||||
logs: logs,
|
||||
feed: new(event.Feed),
|
||||
}
|
||||
}
|
||||
|
||||
// GetLastFewLogs returns the predefined logs.
|
||||
func (m *MockStreamer) GetLastFewLogs() [][]byte {
|
||||
return m.logs
|
||||
}
|
||||
|
||||
// LogsFeed returns the predefined event feed.
|
||||
func (m *MockStreamer) LogsFeed() *event.Feed {
|
||||
return m.feed
|
||||
}
|
||||
Reference in New Issue
Block a user