mirror of
https://github.com/Corsinvest/cv4pve-api-php.git
synced 2026-04-25 04:25:48 +03:00
[GH-ISSUE #36] Expose HTTP Headers for requests made with PveClientBase #27
Labels
No labels
enhancement
needs investigation
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cv4pve-api-php#27
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sydive on GitHub (Jul 26, 2024).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-php/issues/36
Hey there, thanks for the library, it's been great to use so far.
Overview
This is more of a feature request than bug, but it appears that the Proxmox API returns errors in HTTP headers, rather than the JSON response body in some cases.
This happens in multiple endpoints, but one example can be seen in
/api2/json/nodes/{node}/qemu/{vmid}/clone(docs here). Here's what the headers looks like:Since this error is in the header rather than body, it's not present in the following methods for the
Resultclass:getReasonPhrase()getResponse()getErrors()It would be useful if the raw headers were accessible by the user in these scenarios.
Steps to Replicate
/etc/pve/qemu-server/<VMID>.conflock: backupto the bottom of the file, to manually lock the templateSolution
There are multiple ways to solve this, but one way could potentially be to add a new field to the
Resultclass, which contains the contents of the raw headers. The headers can then be inspected by the user when they encounter an error, if they need to.I believe the code would need to be added somewhere here: https://github.com/Corsinvest/cv4pve-api-php/blob/master/src/PveClientBase.php#L460
Happy to create a PR for this feature. Thanks for reading.
@franklupo commented on GitHub (Jul 26, 2024):
If you want to create a PR.
best regards
@sydive commented on GitHub (Jul 29, 2024):
I've created a PR here: https://github.com/Corsinvest/cv4pve-api-php/pull/37
Could you please take a look when you have some time?