Navigation Menu

Skip to content

Commit

Permalink
Merge pull request aws#730 from jeskew/fix/map-request-middleware-doc…
Browse files Browse the repository at this point in the history
…umentation

Correct example for MapRequest middleware. Resolves aws#729
  • Loading branch information
jeskew committed Aug 17, 2015
2 parents 5495143 + fc2fea3 commit 1801923
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/guide/handlers-and-middleware.rst
Expand Up @@ -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');
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Expand Up @@ -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`
Expand Down

0 comments on commit 1801923

Please sign in to comment.