From 1329aa51b605cb54ba9aae3a82a0a87b881fb7b3 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 13 Nov 2017 09:09:58 -0800 Subject: Updating server dependancies. (#7816) --- vendor/gopkg.in/olivere/elastic.v5/client.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'vendor/gopkg.in/olivere/elastic.v5/client.go') diff --git a/vendor/gopkg.in/olivere/elastic.v5/client.go b/vendor/gopkg.in/olivere/elastic.v5/client.go index 13b45d831..9a48d9ac7 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/client.go +++ b/vendor/gopkg.in/olivere/elastic.v5/client.go @@ -26,7 +26,7 @@ import ( const ( // Version is the current version of Elastic. - Version = "5.0.48" + Version = "5.0.53" // DefaultURL is the default endpoint of Elasticsearch on the local machine. // It is used e.g. when initializing a new Client without a specific URL. @@ -1168,12 +1168,18 @@ func (c *Client) mustActiveConn() error { } // PerformRequest does a HTTP request to Elasticsearch. +// See PerformRequestWithContentType for details. +func (c *Client) PerformRequest(ctx context.Context, method, path string, params url.Values, body interface{}, ignoreErrors ...int) (*Response, error) { + return c.PerformRequestWithContentType(ctx, method, path, params, body, "application/json", ignoreErrors...) +} + +// PerformRequestWithContentType executes a HTTP request with a specific content type. // It returns a response (which might be nil) and an error on failure. // // Optionally, a list of HTTP error codes to ignore can be passed. // This is necessary for services that expect e.g. HTTP status 404 as a // valid outcome (Exists, IndicesExists, IndicesTypeExists). -func (c *Client) PerformRequest(ctx context.Context, method, path string, params url.Values, body interface{}, ignoreErrors ...int) (*Response, error) { +func (c *Client) PerformRequestWithContentType(ctx context.Context, method, path string, params url.Values, body interface{}, contentType string, ignoreErrors ...int) (*Response, error) { start := time.Now().UTC() c.mu.RLock() @@ -1236,6 +1242,9 @@ func (c *Client) PerformRequest(ctx context.Context, method, path string, params if basicAuth { req.SetBasicAuth(basicAuthUsername, basicAuthPassword) } + if contentType != "" { + req.Header.Set("Content-Type", contentType) + } // Set body if body != nil { -- cgit v1.2.3-1-g7c22