AWS released the Release Candidate (RC) of the AWS SDK for JavaScript, version 3 (v3) on October 19th, 2020,. One of the important changes in v3 is the introduction of the middleware stack, which customizes the SDK behavior by modifying the middleware.
The JavaScript SDK maintains a series of asynchronous actions. These series include actions that serialize input parameters into the data over the wire and deserialize response data into JavaScript objects. Such actions are implemented using functions called middleware and executed in a specific order. The object that hosts all the middleware including the ordering information is called a Middleware Stack. You can add your custom actions to the SDK and/or remove the default ones.
When an API call is made, SDK sorts the middleware according to the step it belongs to and its priority within each step. The input parameters pass through each middleware. An HTTP request gets created and updated along the process. The HTTP Handler sends a request to the service and receives a response. A response object is passed back through the same middleware stack in reverse and is deserialized into a JavaScript object.
You can get more details about the Middleware Stack in Modular AWS SDK for JavaScript in the AWS developer blog.
Comments (0)