|
19 | 19 | <%- if ['bulk', 'msearch', 'msearch_template', 'find_structure'].include? @method_name -%>
|
20 | 20 | <%= self.send("#{@method_name}_body_helper".to_s) %>
|
21 | 21 | headers.merge!("Content-Type" => "application/x-ndjson")
|
22 |
| - <%= ' '*(@namespace_depth+4) %>perform_request(method, path, params, payload, headers).body |
| 22 | + Elasticsearch::API::Response.new( |
| 23 | + perform_request(method, path, params, payload, headers) |
| 24 | + ) |
23 | 25 | <%- elsif @method_name == 'ping' -%>
|
24 | 26 | <%= ping_perform_request %>
|
25 | 27 | <%- else -%>
|
26 | 28 | <%- if needs_ignore_404?(@endpoint_name) %>
|
27 | 29 | Utils.__rescue_from_not_found do
|
28 |
| - perform_request(method, path, params, body, headers).status == 200 ? true : false |
| 30 | + perform_request(method, path, params, body, headers).status == 200 ? true : false |
29 | 31 | end
|
30 | 32 | <%- elsif needs_complex_ignore_404?(@endpoint_name) -%>
|
31 | 33 | if Array(arguments[:ignore]).include?(404)
|
32 |
| - Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body } |
| 34 | + Utils.__rescue_from_not_found { |
| 35 | + Elasticsearch::API::Response.new( |
| 36 | + perform_request(method, path, params, body, headers) |
| 37 | + ) |
| 38 | + } |
33 | 39 | else
|
34 |
| - perform_request(method, path, params, body, headers).body |
| 40 | + Elasticsearch::API::Response.new( |
| 41 | + perform_request(method, path, params, body, headers) |
| 42 | + ) |
35 | 43 | end
|
36 | 44 | <%- else -%>
|
37 |
| - perform_request(method, path, params, body, headers).body |
| 45 | + Elasticsearch::API::Response.new( |
| 46 | + perform_request(method, path, params, body, headers) |
| 47 | + ) |
38 | 48 | <%- end -%>
|
39 | 49 | <%- end -%>
|
40 | 50 | <%= ' '*(@namespace_depth+3) %>end
|
0 commit comments