Skip to content

Commit

Permalink
Fix sensors path and response
Browse files Browse the repository at this point in the history
  • Loading branch information
ltsonov-cb committed Sep 12, 2023
1 parent 064570d commit bffcf91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cbcontainers/communication/gateway/api_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (gateway *ApiGateway) GetSensorMetadata() ([]models.SensorMetadata, error)
Sensors []models.SensorMetadata `json:"sensors"`
}

url := gateway.baseUrl("/setup/sensors")
url := gateway.baseUrl("setup/sensors")
resp, err := gateway.baseRequest().
SetResult(getSensorsResponse{}).
Get(url)
Expand All @@ -186,8 +186,8 @@ func (gateway *ApiGateway) GetSensorMetadata() ([]models.SensorMetadata, error)
return nil, fmt.Errorf("failed to get sensor metadata with status code (%d)", resp.StatusCode())
}

r, ok := resp.Result().(getSensorsResponse)
if !ok {
r, ok := resp.Result().(*getSensorsResponse)
if !ok || r == nil {
return nil, fmt.Errorf("malformed sensor metadata response")
}
return r.Sensors, nil
Expand Down

0 comments on commit bffcf91

Please sign in to comment.