Skip to content

Commit

Permalink
Add setting content-length middleware into operation stack (aws#634)
Browse files Browse the repository at this point in the history
Adds the ContentLengthMiddleware to the operation's stack, and updates generated clients and protocol tests to use the content-length check.

Depends on:
* aws/smithy-go#108
* smithy-lang/smithy#491
  • Loading branch information
jasdel authored and skmcgrail committed Aug 21, 2020
1 parent 1b93007 commit 37a8ed7
Show file tree
Hide file tree
Showing 204 changed files with 4,115 additions and 3,629 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Map;
import software.amazon.smithy.aws.traits.auth.SigV4Trait;
import software.amazon.smithy.aws.traits.auth.UnsignedPayloadTrait;
import software.amazon.smithy.go.codegen.SmithyGoDependency;
import software.amazon.smithy.go.codegen.SymbolUtils;
import software.amazon.smithy.go.codegen.integration.GoIntegration;
import software.amazon.smithy.go.codegen.integration.MiddlewareRegistrar;
Expand Down Expand Up @@ -43,6 +44,16 @@ public List<RuntimeClientPlugin> getClientPlugins() {
)
.build(),

// Add ContentLengthMiddleware to operation stack
RuntimeClientPlugin.builder()
.registerMiddleware(MiddlewareRegistrar.builder()
.resolvedFunction(SymbolUtils.createValueSymbolBuilder(
"AddContentLengthMiddleware", SmithyGoDependency.SMITHY_HTTP_TRANSPORT)
.build())
.build()
)
.build(),

// Add endpoint serialize middleware to operation stack
RuntimeClientPlugin.builder()
.registerMiddleware(MiddlewareRegistrar.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static void generateHttpProtocolTests(GenerationContext context) {
writer.addUseImports(SmithyGoDependency.SMITHY_MIDDLEWARE);
writer.openBlock("[]APIOptionFunc{", "},", () -> {
writer.openBlock("func(s *middleware.Stack) error {", "},", () -> {
writer.write("s.Build.Clear()");
writer.write("s.Finalize.Clear()");
writer.write("return nil");
});
Expand Down

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading

0 comments on commit 37a8ed7

Please sign in to comment.