mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> Resolves #40593 This PR attempts to fix this error: ``` {"component":"http","err":"associating asset with adamID <adamId> to host <hostId>: making request to Apple VPP endpoint: making request to Apple VPP endpoint: Post \"https://vpp.itunes.apple.com/mdm/v2/assets/associate\": http: ContentLength=111 with Body length 0","host_id":<hostId>,"ip_addr":"<ip_addr>","level":"error","method":"POST","took":"20.748056032s","ts":"2026-02-25T09:53:32.10267006Z","uri":"/api/latest/fleet/device/<deviceId>/software/install/<id>","x_for_ip_addr":"<ip_addr>"} ``` Per my troubleshooting: `client.Do(req)` consumes the request body. When retrying, the same `req` is reused but its body is not there -- so, the retry sends `ContentLength=108` with an empty body, producing the `Body length 0` error. # Checklist for submitter If some of the following don't apply, delete the relevant line. - [ ] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. - [ ] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [ ] If paths of existing endpoints are modified without backwards compatibility, checked the frontend/CLI for any necessary changes ## Testing - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually Ran the test I added without the code fix, and was able to see the exact same error <img width="1188" height="567" alt="Screenshot 2026-02-25 at 3 26 12 PM" src="https://github.com/user-attachments/assets/d7bdfee7-de33-43d0-92c6-e77fa46329d6" /> After: <img width="852" height="140" alt="Screenshot 2026-02-25 at 3 26 55 PM" src="https://github.com/user-attachments/assets/e7ec3ea5-2b29-463a-9038-e5530d654a4d" /> |
||
|---|---|---|
| .. | ||
| api.go | ||
| api_test.go | ||
| refresh.go | ||