forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle inbound exceptions on streaming request APIs (elastic#113303)
Today if we submit a request with e.g. invalid credentials to the `/_bulk` API then we throw a `ClassCastException` trying to cast the `DefaultHttpRequest` to a `FullHttpRequest` on the error path. This commit fixes the problem.
- Loading branch information
1 parent
b2eb101
commit f920e52
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/security/10_forbidden.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
"Test basic response with invalid credentials": | ||
|
||
- skip: | ||
features: headers | ||
|
||
- do: | ||
headers: | ||
Authorization: "Basic dGVzdF91c2VyOndyb25nLXBhc3N3b3Jk" # invalid credentials | ||
info: {} | ||
catch: unauthorized | ||
|
||
- match: | ||
error.root_cause.0.type: security_exception | ||
|
||
--- | ||
"Test bulk response with invalid credentials": | ||
|
||
- skip: | ||
features: headers | ||
|
||
- do: | ||
headers: | ||
Authorization: "Basic dGVzdF91c2VyOndyb25nLXBhc3N3b3Jk" # invalid credentials | ||
bulk: | ||
body: | | ||
{"index": {}} | ||
{} | ||
catch: unauthorized | ||
- match: | ||
error.root_cause.0.type: security_exception |