Skip to content

Commit

Permalink
All requests use Content-Type of application/json
Browse files Browse the repository at this point in the history
Elasticsearch disabled Content-Type negotiation with 5.3.0. We now
always pass Content-Type: application/json by default.

See #511
  • Loading branch information
olivere committed Apr 18, 2017
1 parent cb5134b commit 00cf81d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions clear_scroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package elastic
import (
"fmt"
"net/url"
"strings"

"golang.org/x/net/context"
)
Expand Down Expand Up @@ -82,7 +81,9 @@ func (s *ClearScrollService) Do(ctx context.Context) (*ClearScrollResponse, erro
}

// Setup HTTP request body
body := strings.Join(s.scrollId, ",")
body := map[string][]string{
"scroll_id": s.scrollId,
}

// Get HTTP response
res, err := s.client.PerformRequest(ctx, "DELETE", path, params, body)
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

const (
// Version is the current version of Elastic.
Version = "5.0.34"
Version = "5.0.35"

// 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.
Expand Down
1 change: 1 addition & 0 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func NewRequest(method, url string) (*Request, error) {
}
req.Header.Add("User-Agent", "elastic/"+Version+" ("+runtime.GOOS+"-"+runtime.GOARCH+")")
req.Header.Add("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
return (*Request)(req), nil
}

Expand Down

0 comments on commit 00cf81d

Please sign in to comment.