Bug #3880
closedheaders passed into api should be cloned before modified
Description
The headers passed into api calls such as index(), create(), etc. take two args, params and headers. The headers passed in are modified during the api call to include the params which lead to errors in my program. We should clone the the hash before modifying it to avoid this potentially confusing behavior to the consumer of the api.
Updated by Dominic Cleal almost 11 years ago
- Status changed from New to Need more information
Sorry, can you elaborate on this please? I don't follow what you mean from the issue description. Pointers to code might help.
Updated by Thomas McKay almost 11 years ago
Dominic Cleal wrote:
Sorry, can you elaborate on this please? I don't follow what you mean from the issue description. Pointers to code might help.
https://github.com/theforeman/foreman_api/blob/master/lib/foreman_api/base.rb?source=cc#L55
Note that http_call() takes in headers arg and then modifies it by adding the params.
In my case, I had defined a variable HEADERS that I was re-using by passing into the various api calls (.index, .create, .update, etc.). However, this variable was, incorrectly imo, being modified by the api calls due to above code.
Updated by Dominic Cleal almost 11 years ago
- Category changed from API to 65
- Status changed from Need more information to Assigned
- Assignee set to Martin Bacovsky
Gotcha, thanks.
Updated by Tomer Brisker almost 10 years ago
- Status changed from Assigned to New
Updated by Leos Stejskal over 3 years ago
- Status changed from New to Closed
Hi, I'm closing the issue, it has been here for some time and I wasn't able to reproduce it on the latest version.
If you think that the issue is still relevant feel free to reopen it.