Skip to content

Commit

Permalink
Add bad_request to the rest-api-spec catch params (#26539)
Browse files Browse the repository at this point in the history
This adds another request to the catch params. It also makes sure that
the generic request param does not allow 400 either.
  • Loading branch information
hub-cap authored Sep 14, 2017
1 parent 1ca0b5e commit f385e0c
Show file tree
Hide file tree
Showing 40 changed files with 57 additions and 54 deletions.
4 changes: 2 additions & 2 deletions docs/reference/api-conventions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ invalid `size` parameter to the `_search` API:
POST /twitter/_search?size=surprise_me
----------------------------------------------------------------------
// CONSOLE
// TEST[s/surprise_me/surprise_me&error_trace=false/ catch:request]
// TEST[s/surprise_me/surprise_me&error_trace=false/ catch:bad_request]
// Since the test system sends error_trace=true by default we have to override

The response looks like:
Expand Down Expand Up @@ -636,7 +636,7 @@ But if you set `error_trace=true`:
POST /twitter/_search?size=surprise_me&error_trace=true
----------------------------------------------------------------------
// CONSOLE
// TEST[catch:request]
// TEST[catch:bad_request]

The response looks like:

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/ingest.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PUT my-index/my-type/my-id?pipeline=my_pipeline_id
}
--------------------------------------------------
// CONSOLE
// TEST[catch:request]
// TEST[catch:bad_request]

See <<ingest-apis,Ingest APIs>> for more information about creating, adding, and deleting pipelines.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/mapping/fields/routing-field.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ PUT my_index2/my_type/1 <2>
}
------------------------------
// CONSOLE
// TEST[catch:request]
// TEST[catch:bad_request]
<1> Routing is required for `my_type` documents.
<2> This index request throws a `routing_missing_exception`.

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/mapping/params/coerce.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ PUT my_index/my_type/2
}
--------------------------------------------------
// CONSOLE
// TEST[catch:request]
// TEST[catch:bad_request]
<1> The `number_one` field will contain the integer `10`.
<2> This document will be rejected because coercion is disabled.

Expand Down Expand Up @@ -88,6 +88,6 @@ PUT my_index/my_type/2
{ "number_two": "10" } <2>
--------------------------------------------------
// CONSOLE
// TEST[catch:request]
// TEST[catch:bad_request]
<1> The `number_one` field overrides the index level setting to enable coercion.
<2> This document will be rejected because the `number_two` field inherits the index-level coercion setting.
2 changes: 1 addition & 1 deletion docs/reference/mapping/params/ignore-malformed.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ PUT my_index/my_type/2
}
--------------------------------------------------
// CONSOLE
// TEST[catch:request]
// TEST[catch:bad_request]
<1> This document will have the `text` field indexed, but not the `number_one` field.
<2> This document will be rejected because `number_two` does not allow malformed values.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
version: " - 5.99.99"
reason: normalizer support in 6.0.0
- do:
catch: request
catch: bad_request
indices.analyze:
body:
text: ABc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ teardown:
---
"Test invalid processor config":
- do:
catch: request
catch: bad_request
ingest.put_pipeline:
id: "my_pipeline"
body: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ teardown:
---
"Test pipeline with empty on_failure in a processor":
- do:
catch: request
catch: bad_request
ingest.put_pipeline:
id: "my_pipeline"
body: >
Expand Down Expand Up @@ -155,7 +155,7 @@ teardown:
---
"Test pipeline with empty on_failure in pipeline":
- do:
catch: request
catch: bad_request
ingest.put_pipeline:
id: "my_pipeline"
body: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ teardown:
---
"Test simulate with provided invalid pipeline definition":
- do:
catch: request
catch: bad_request
ingest.simulate:
body: >
{
Expand Down Expand Up @@ -183,7 +183,7 @@ teardown:
---
"Test simulate with no provided pipeline or pipeline_id":
- do:
catch: request
catch: bad_request
ingest.simulate:
body: >
{
Expand All @@ -206,7 +206,7 @@ teardown:
---
"Test simulate with invalid processor config":
- do:
catch: request
catch: bad_request
ingest.simulate:
body: >
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
count: 1

- do:
catch: request
catch: bad_request
update:
index: test_1
type: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
indices.refresh: {}

- do:
catch: request
catch: bad_request
update_by_query:
refresh: true
index: twitter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ be caught and tested. For instance:
The argument to `catch` can be any of:
[horizontal]
`bad_request`:: a 400 response from ES
`unauthorized`:: a 401 response from ES
`forbidden`:: a 403 response from ES
`missing`:: a 404 response from ES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
index: index1

- do:
catch: request
catch: bad_request
cat.segments:
index: index1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ setup:
---
"count body without query element":
- do:
catch: request
catch: bad_request
count:
index: test
body:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
reason: validation logic only fixed from 5.1.2 onwards

- do:
catch: request
catch: bad_request
create:
index: test
type: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
reason: validation logic only fixed from 5.1.2 onwards

- do:
catch: request
catch: bad_request
create:
index: test
type: test
Expand All @@ -20,7 +20,7 @@
- match: { error.reason: "Validation Failed: 1: create operations only support internal versioning. use index instead;" }

- do:
catch: request
catch: bad_request
create:
index: test
type: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ setup:
"Parent omitted":

- do:
catch: request
catch: bad_request
exists:
index: test_1
type: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ setup:
---
"Explain body without query element":
- do:
catch: request
catch: bad_request
explain:
index: test_1
type: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ setup:
---
"Parent omitted":
- do:
catch: request
catch: bad_request
get:
index: test_1
type: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ setup:
"Parent omitted":

- do:
catch: request
catch: bad_request
get_source:
index: test_1
type: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
- match: { _source: { foo: bar }}

- do:
catch: request
catch: bad_request
index:
index: idx
type: type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ setup:
version: " - 5.99.0"
reason: delete index doesn't support aliases only from 6.0.0 on
- do:
catch: request
catch: bad_request
indices.delete:
index: alias
- do:
Expand Down Expand Up @@ -42,7 +42,7 @@ setup:
version: " - 5.99.0"
reason: delete index doesn't support aliases only from 6.0.0 on
- do:
catch: request
catch: bad_request
indices.delete:
index: alias,index2
- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
index: test_index

- do:
catch: request
catch: bad_request
search:
index: test_index

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ setup:
index: _all

- do:
catch: request
catch: bad_request
search:
index: test_index2

Expand All @@ -59,7 +59,7 @@ setup:
index: test_*

- do:
catch: request
catch: bad_request
search:
index: test_index2

Expand All @@ -86,7 +86,7 @@ setup:
index: '*'

- do:
catch: request
catch: bad_request
search:
index: test_index3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
index: test_index

- do:
catch: request
catch: bad_request
indices.put_alias:
index: test_index
name: test_*
Expand All @@ -55,7 +55,7 @@
index: foo

- do:
catch: request
catch: bad_request
indices.put_alias:
index: test_index
name: foo
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
- match: {test.settings: {index.number_of_shards: '1', index.number_of_replicas: '0'}}

- do:
catch: request
catch: bad_request
indices.put_template:
name: test
create: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
index: index1

- do:
catch: request
catch: bad_request
indices.segments:
index: index1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ setup:
version: " - 5.0.99"
reason: strict stats handling does not exist in 5.0
- do:
catch: request
catch: bad_request
indices.stats:
metric: [ fieldata ]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
version: " - 5.0.99"
reason: strict stats handling does not exist in 5.0
- do:
catch: request
catch: bad_request
nodes.stats:
metric: [ transprot ]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ setup:
"Aggregating wrong datatype test":

- do:
catch: request
catch: bad_request
search:
body:
aggs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ setup:
"Aggregating wrong datatype test":

- do:
catch: request
catch: bad_request
search:
body:
aggs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ setup:
"Aggregating wrong datatype test":

- do:
catch: request
catch: bad_request
search:
body:
aggs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ setup:
"Aggregating wrong datatype test":

- do:
catch: request
catch: bad_request
search:
body:
aggs:
Expand Down
Loading

0 comments on commit f385e0c

Please sign in to comment.