# Connector Development Kit (CDK) - DSL Library Update (Version 2.1.0) 

### **What’s New in CDK v2.1.0?**

We have made an update to our Connector Development Kit (CDK) Domain Specific Language (DSL) library, now available in [version 2.1.0](https://www.npmjs.com/package/@trayio/cdk-dsl).

If you’re an active user of the CDK, we strongly recommend you carefully read this update in its entirety as it contains important information on **breaking changes**.

This update introduces some key enhancements that streamline the handling of HTTP operations and improve overall functionality.

* **Mandatory Body Specification**: You now need to explicitly specify request bodies in the DSL, even if they are empty.
* **Content-Type Specification**: When specifying the body, the content type for both requests and responses is set, allowing the runtime to serialise or deserialise the body accordingly.

### User-Facing Changes

* **Request Body Specification**: All request bodies must now be explicitly declared, even when empty. This is achieved using the `withoutBody()` function.
* **Enhanced Error Handling for Responses**: The `handleResponse` method includes an additional `withErrorHandling` method, allowing for custom handling of non-2xx responses. This is optional, with the default behaviour being failure on any non-2xx response.
* **Callback in **`**parseBodyAs<Type>**`** Methods**: This update mandates callbacks in these methods, except for JSON (and potentially files in the future), enhancing the DSL's type safety.
* \*\*Context and Input Access in **`**handleResponse**`**: \*\*`handleResponse` methods now have access to the context and input, similar to the `handleRequest` methods. This allows for more comprehensive handling and processing of responses.

To ensure uninterrupted service and compatibility, you are required to:

* Update to the CDK-DSL library version 2.1.0.
* Make necessary changes in the `handleRequest` and `handleResponse` methods as outlined above.

### Breaking Changes

With this release, previous versions of the CLI will no longer be supported for deployments. Please update to version 2.1.0 and review the below *Before* and \*After \*examples to better understand the changes you need to make in your code.

* **Changes in handleRequest and handleResponse Methods**:

  * Before (handle**Request**):
    `.handleRequest((ctx, input, request) => request.addPathParameter('id', input.id.toString())
    `
  * After (handle**Request**):
    `.handleRequest((ctx, input, request) =>	request.addPathParameter('id', input.id.toString()).withoutBody() --> notice the `withoutBody() function`
    `
  * Before (handle**Response**):
    `.handleResponse((response) => response.parseWithBodyAsJson())
    `
  * After (handle**Response**):
    `.handleResponse((ctx, input, response) => response.parseWithBodyAsJson()
    ))  -> notice the extra arguments and the change in position`
