new-counter-demo HTTP push panics when the target endpoint is unreachable
- Dominant language
- Go
- Stars
- 269
- Forks
- 174
- PR merge metrics
- No merged PRs in 30d
Description
**What happened**:
The HTTP push method in `new-counter-demo/virtualprotocol/data/publish/http/client.go` dereferences `resp.Body` after `http.Post` returns an error. When the endpoint is unreachable, `resp` is nil and the mapper panics instead of returning from the failed publish attempt.
**What I expected to happen**:
A failed HTTP publish should be logged and returned without panicking the virtual protocol process.
**How to reproduce it (as minimally and precisely as possible)**:
1. Configure the HTTP push method with an unavailable endpoint.
2. Call the push method with one device data value.
3. Observe the nil pointer panic at `defer resp.Body.Close()`.
A focused regression test using `127.0.0.1:1` reproduces the failed request path without requiring a device or cluster.
**Anything else we need to know?**:
The fix is limited to the error path and preserves successful response handling.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.