Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include elastic-api-version header in Kibana requests #1526

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/kibana/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func (c *Client) InstallZipPackage(zipFile string) ([]packages.Asset, error) {
return nil, err
}
req.Header.Set("Content-Type", "application/zip")
req.Header.Add("elastic-api-version", "2023-10-31")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this header be added for all other requests performed by elastic-package (dashboards, status...)?

Maybe, it can be added (or moved?) here for all of them:

req.Header.Add("kbn-xsrf", install.DefaultStackVersion)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, it only seems to be required here, maybe this API has been GA'ed on this version?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I guess we could keep it here, and move it to the newRequest() function if there are new other API requests failing with the same error.


statusCode, respBody, err := c.doRequest(req)
if err != nil {
Expand Down