Skip to content

Commit

Permalink
Update remaining preserve calls so that protocol will be carried forw…
Browse files Browse the repository at this point in the history
…ard.

Notice that headers are required to contain 'host' for http/1.1, so strictly speaking, copying headers AND protocol should be safer so that we stay in compliance.

Signed-off-by: Greg Schohn <[email protected]>
  • Loading branch information
gregschohn committed Dec 9, 2024
1 parent 1df1642 commit fbc0291
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{%- macro make_request() -%}
{ "method": "GET", "URI": "/" }
{ "method": "GET", "URI": "/", "protocol": "HTTP/1.0" }
{%- endmacro -%}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

{%- macro rewrite_bulk_for_default_source_index(uri_match, input_map, source_index) -%}
{
"preserve": ["headers","method","URI","protocol"],
"preserveWhenMissing": "*",
"payload": {
"inlinedJsonSequenceBodies": [
{%- set operation_types = ['delete', 'update', 'index', 'create'] -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"method": "{{ input_map.request.method }}",
"URI": "/{{ target_index }}/_doc/{{ match.group3 }}",
"preserve": ["headers","payload"]
"preserveWhenMissing": ["headers","payload"]
}
{%- endif -%}
{%- endmacro -%}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public void testPutSingleTypeToMissingTarget() throws Exception {
var indexTypeMappingRewriter = makeIndexTypeMappingRewriter();
var result = (Map<String, Object>)
indexTypeMappingRewriter.transformJson(OBJECT_MAPPER.readValue(testString, LinkedHashMap.class));
Assertions.assertEquals(JsonNormalizer.fromString("{ \"method\": \"GET\", \"URI\": \"/\" }"),
var expected = "{ \"method\": \"GET\", \"URI\": \"/\", \"protocol\" : \"HTTP/1.0\" }";
Assertions.assertEquals(JsonNormalizer.fromString(expected),
JsonNormalizer.fromObject(result));
}

Expand Down

0 comments on commit fbc0291

Please sign in to comment.