mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-18 05:00:03 +02:00
src/api/test.go: rename from TestApi to DebugApi
This commit is contained in:
parent
bda40bf1d5
commit
edb063722b
2 changed files with 10 additions and 10 deletions
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/eosswedenorg-go/haproxy/agentcheck"
|
||||
)
|
||||
|
||||
type TestApi struct {
|
||||
type DebugApi struct {
|
||||
response agentcheck.Response
|
||||
}
|
||||
|
||||
|
|
@ -25,22 +25,22 @@ func parseResponse(resp string) (agentcheck.Response, error) {
|
|||
return agentcheck.NewStatusResponse(rtype), nil
|
||||
}
|
||||
|
||||
func NewTestApi(response string) TestApi {
|
||||
func NewDebugApi(response string) DebugApi {
|
||||
|
||||
resp, _ := parseResponse(response)
|
||||
|
||||
return TestApi{
|
||||
return DebugApi{
|
||||
response: resp,
|
||||
}
|
||||
}
|
||||
|
||||
func (t TestApi) LogInfo() LogParams {
|
||||
func (d DebugApi) LogInfo() LogParams {
|
||||
return LogParams{
|
||||
"type", "TestApi",
|
||||
"response", t.response,
|
||||
"type", "Debug",
|
||||
"response", strings.TrimSpace(d.response.String()),
|
||||
}
|
||||
}
|
||||
|
||||
func (t TestApi) Call() (agentcheck.Response, string) {
|
||||
return t.response, ""
|
||||
func (d DebugApi) Call() (agentcheck.Response, string) {
|
||||
return d.response, ""
|
||||
}
|
||||
|
|
@ -58,8 +58,8 @@ func ParseRequest(request string) (api.ApiInterface, error) {
|
|||
return api.NewEosioV2(a.url, a.host, int64(a.num_blocks)), nil
|
||||
case "contract":
|
||||
return api.NewEosioContract(a.url, float64(a.num_blocks / 2)), nil
|
||||
case "test":
|
||||
return api.NewTestApi(a.url), nil
|
||||
case "debug":
|
||||
return api.NewDebugApi(a.url), nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("Invalid API '%s'", p[0])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue