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

[Filebeat][http_endpoint] Removing enforcement of accept header #18768

Merged
merged 2 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions x-pack/filebeat/input/http_endpoint/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,6 @@ func (in *HttpEndpoint) validateHeader(w http.ResponseWriter, r *http.Request) (
return http.StatusUnsupportedMediaType, in.createErrorMessage("Wrong Content-Type header, expecting application/json")
}

if r.Header.Get("Accept") != "application/json" {
return http.StatusNotAcceptable, in.createErrorMessage("Wrong Accept header, expecting application/json")
}
return 0, ""
}

Expand Down
18 changes: 0 additions & 18 deletions x-pack/filebeat/tests/system/test_http_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,6 @@ def test_http_endpoint_wrong_content_header(self):
assert r.status_code == 415
assert r.text == '{"message": "Wrong Content-Type header, expecting application/json"}'

def test_http_endpoint_wrong_accept_header(self):
"""
Test http_endpoint input with wrong accept header.
"""
self.get_config()
filebeat = self.start_beat()
self.wait_until(lambda: self.log_contains("Starting HTTP server on {}:{}".format(self.host, self.port)))

message = "somerandommessage"
payload = {self.prefix: message}
headers = {"Content-Type": "application/json", "Accept": "application/xml"}
r = requests.post(self.url, headers=headers, data=json.dumps(payload))

filebeat.check_kill_and_wait()

assert r.status_code == 406
assert r.text == '{"message": "Wrong Accept header, expecting application/json"}'

def test_http_endpoint_missing_auth_value(self):
"""
Test http_endpoint input with missing basic auth values.
Expand Down