mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-25 23:24:21 +02:00
Compare commits
2 Commits
fix/es8-he
...
fix/releas
| Author | SHA1 | Date | |
|---|---|---|---|
| a5933e226b | |||
| 5a74b2f72b |
@@ -6,8 +6,8 @@ labels:
|
|||||||
steps:
|
steps:
|
||||||
goreleaser:
|
goreleaser:
|
||||||
image: goreleaser/goreleaser
|
image: goreleaser/goreleaser
|
||||||
when:
|
# when:
|
||||||
event: [tag,manual]
|
# event: [tag,manual]
|
||||||
environment:
|
environment:
|
||||||
GITEA_TOKEN:
|
GITEA_TOKEN:
|
||||||
from_secret: DEPLOY_TOKEN
|
from_secret: DEPLOY_TOKEN
|
||||||
|
|||||||
@@ -189,7 +189,6 @@ func (cluster *Cluster) getDefaultOptions() []elasticsearch.Option {
|
|||||||
cluster.getTransport(),
|
cluster.getTransport(),
|
||||||
elastictransport.WithHeader(headers),
|
elastictransport.WithHeader(headers),
|
||||||
),
|
),
|
||||||
elasticsearch.WithCompatibilityMode(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,9 +203,7 @@ func (cluster *Cluster) getTransport() elastictransport.Option {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return elastictransport.WithTransport(
|
return elastictransport.WithTransport(transport)
|
||||||
&CompatibilityTransport{Transport: transport},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (conf *Config) SetupES() error {
|
func (conf *Config) SetupES() error {
|
||||||
|
|||||||
@@ -53,11 +53,6 @@ func (t *DebugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
contentline = buf.String()
|
contentline = buf.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.Header.Get("Accept") != "" {
|
|
||||||
req.Header.Del("Accept")
|
|
||||||
req.Header.Add("Accept", "application/json")
|
|
||||||
}
|
|
||||||
|
|
||||||
slog.Info("req", "host", req.URL.Host, "uri", req.URL.Path,
|
slog.Info("req", "host", req.URL.Host, "uri", req.URL.Path,
|
||||||
"body", content, "bodyline", contentline,
|
"body", content, "bodyline", contentline,
|
||||||
"headers", req.Header,
|
"headers", req.Header,
|
||||||
@@ -65,21 +60,3 @@ func (t *DebugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
|
|
||||||
return t.Transport.RoundTrip(req)
|
return t.Transport.RoundTrip(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fixes https://codeberg.org/scip/esctl/issues/79:
|
|
||||||
// the API client has this Accept header hardcoded everywhere:
|
|
||||||
// req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=9")
|
|
||||||
// While this works pretty well with ES9, it doesn't with ES8. So, we replace
|
|
||||||
// this header with a new one without the compatibility part.
|
|
||||||
type CompatibilityTransport struct {
|
|
||||||
Transport http.RoundTripper
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *CompatibilityTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
||||||
if req.Header.Get("Accept") != "" {
|
|
||||||
req.Header.Del("Accept")
|
|
||||||
req.Header.Add("Accept", "application/json")
|
|
||||||
}
|
|
||||||
|
|
||||||
return t.Transport.RoundTrip(req)
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user