Skip to content

Commit

Permalink
Fix tests from updating smithy version
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Oct 18, 2024
1 parent 050b1fb commit b1144ad
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 36 deletions.
58 changes: 29 additions & 29 deletions codegen/projections/rails_json/lib/rails_json/builders.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 21 additions & 2 deletions codegen/projections/rails_json/spec/protocol_spec.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,10 @@ public Void floatShape(FloatShape shape) {
public Void stringShape(StringShape shape) {
// string values with a mediaType trait are always base64 encoded.
if (shape.hasTrait(MediaTypeTrait.class)) {
writer.write("$1L$3T::strict_encode64($2L).strip unless $2L.nil? || $2L.empty?",
writer.write("$1L$3T::strict_encode64($2L).strip unless $2L.nil?",
dataSetter, inputGetter, RubyImportContainer.BASE64);
} else {
writer.write("$1L$2L unless $2L.nil? || $2L.empty?", dataSetter, inputGetter);
writer.write("$1L$2L unless $2L.nil?", dataSetter, inputGetter);
}
return null;
}
Expand All @@ -434,7 +434,7 @@ public Void timestampShape(TimestampShape shape) {

@Override
public Void listShape(ListShape shape) {
writer.openBlock("unless $1L.nil? || $1L.empty?", inputGetter)
writer.openBlock("unless $1L.nil?", inputGetter)
.call(() -> model.expectShape(shape.getMember().getTarget())
.accept(new HeaderListMemberSerializer(inputGetter, dataSetter, shape.getMember())))
.closeBlock("end");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,11 @@ apply NullAndEmptyHeadersClient @httpRequestTests([
protocol: railsJson,
method: "GET",
uri: "/NullAndEmptyHeadersClient",
forbidHeaders: ["X-A", "X-B", "X-C"],
forbidHeaders: ["X-A"],
headers: {
"X-B": ""
"X-C": ""
}
body: "",
params: {
a: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ apply HttpPrefixHeaders @httpRequestTests([
},
{
id: "RailsJsonHttpPrefixHeadersAreNotPresent",
documentation: "No prefix headers are serialized because the value is empty",
documentation: "No prefix headers are serialized because the value is not present",
protocol: railsJson,
method: "GET",
uri: "/HttpPrefixHeaders",
Expand All @@ -56,6 +56,23 @@ apply HttpPrefixHeaders @httpRequestTests([
},
appliesTo: "client"
},
{
id: "RailsJsonHttpPrefixEmptyHeaders",
documentation: "Serialize prefix headers were the value is present but empty"
protocol: railsJson,
method: "GET",
uri: "/HttpPrefixHeaders",
body: "",
params: {
fooMap: {
Abc: ""
}
},
headers: {
"X-Foo-Abc": ""
}
appliesTo: "client",
}
])

apply HttpPrefixHeaders @httpResponseTests([
Expand Down

0 comments on commit b1144ad

Please sign in to comment.