mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-07-03 11:53:43 +02:00
internal/api/debug.go: no need to return error in parseResponse() as it is always nil.
This commit is contained in:
parent
aff3737f67
commit
4cdae2d3f1
1 changed files with 5 additions and 7 deletions
|
|
@ -10,18 +10,18 @@ type DebugApi struct {
|
||||||
response agentcheck.Response
|
response agentcheck.Response
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseResponse(resp string) (agentcheck.Response, error) {
|
func parseResponse(resp string) agentcheck.Response {
|
||||||
parts := strings.SplitN(resp, "#", 2)
|
parts := strings.SplitN(resp, "#", 2)
|
||||||
|
|
||||||
// Status with message
|
// Status with message
|
||||||
if len(parts) > 1 {
|
if len(parts) > 1 {
|
||||||
rtype := agentcheck.StatusMessageResponseType(parts[0])
|
rtype := agentcheck.StatusMessageResponseType(parts[0])
|
||||||
return agentcheck.NewStatusMessageResponse(rtype, parts[1]), nil
|
return agentcheck.NewStatusMessageResponse(rtype, parts[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only status.
|
// Only status.
|
||||||
rtype := agentcheck.StatusResponseType(parts[0])
|
rtype := agentcheck.StatusResponseType(resp)
|
||||||
return agentcheck.NewStatusResponse(rtype), nil
|
return agentcheck.NewStatusResponse(rtype)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DebugApiFactory(args ApiArguments) ApiInterface {
|
func DebugApiFactory(args ApiArguments) ApiInterface {
|
||||||
|
|
@ -29,10 +29,8 @@ func DebugApiFactory(args ApiArguments) ApiInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDebugApi(response string) DebugApi {
|
func NewDebugApi(response string) DebugApi {
|
||||||
resp, _ := parseResponse(response)
|
|
||||||
|
|
||||||
return DebugApi{
|
return DebugApi{
|
||||||
response: resp,
|
response: parseResponse(response),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue