Skip to content

Commit 6aa8abe

Browse files
committed
Handle message field
1 parent 9761a56 commit 6aa8abe

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

api/health/connecthandler/health_connect.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,11 @@ func convertResult(r health.Result) *healthv1.Result {
108108
result.Message = structMsg
109109
}
110110
} else if msg, ok := r.Details.(string); ok {
111-
// Convert string to a Struct with a single field "message"
112-
result.Message = &structpb.Struct{
113-
Fields: map[string]*structpb.Value{
114-
"message": structpb.NewStringValue(msg),
115-
},
116-
}
111+
// Convert string to a Struct with a single field "value"
112+
result.Message, _ = structpb.NewStruct(map[string]interface{}{
113+
"value": msg,
114+
})
117115
}
118-
} else {
119-
// If no details, set empty struct
120-
result.Message = &structpb.Struct{}
121116
}
122117

123118
// Set error field if exists

proto/health/v1/service.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
syntax = "proto3";
22
package health.v1;
33

4-
import "google/protobuf/timestamp.proto";
54
import "google/protobuf/struct.proto";
5+
import "google/protobuf/timestamp.proto";
66

77
option go_package = "github.com/ava-labs/avalanchego/proto/pb/health/v1;healthv1";
88

0 commit comments

Comments
 (0)