diff --git a/docs/guide/handlers-and-middleware.rst b/docs/guide/handlers-and-middleware.rst index 4b2361d28f..85453a2e94 100644 --- a/docs/guide/handlers-and-middleware.rst +++ b/docs/guide/handlers-and-middleware.rst @@ -308,7 +308,7 @@ argument and returns a ``Psr\Http\Message\RequestInterface`` object. ]); // Apply a custom middleware named "add-header" to the "build" lifecycle step - $command->getHandlerList()->prependBuild( + $command->getHandlerList()->appendBuild( Middleware::mapRequest(function (RequestInterface $request) { // Return a new request with the added header return $request->withHeader('X-Foo-Baz', 'Bar'); @@ -320,9 +320,9 @@ Now when the command is executed, it will be sent with the custom header. .. important:: - Notice that the middleware was prepended to the handler list at the - ``init`` step. This is to ensure that the command parameters are not - validated before adding the default parameter. + Notice that the middleware was appended to the handler list at the + end of ``build`` step. This is to ensure that a request has been been + built before this middleware is invoked. mapResult diff --git a/docs/index.rst b/docs/index.rst index 73075293fa..c3998077f2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -48,6 +48,7 @@ SDK Guides * :doc:`guide/credentials` * :doc:`guide/commands` * :doc:`guide/promises` +* :doc:`guide/handlers-and-middleware` * :doc:`guide/paginators` * :doc:`guide/waiters` * :doc:`guide/jmespath`