# ContentHandling

Enum · Stable

- Source: [`aws-apigateway/lib/integration.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigateway/lib/integration.ts#L297)

## Example

TypeScript:

```ts
declare const getBookHandler: lambda.Function;
declare const getBookIntegration: apigateway.LambdaIntegration;

const getBookIntegration = new apigateway.LambdaIntegration(getBookHandler, {
  contentHandling: apigateway.ContentHandling.CONVERT_TO_TEXT, // convert to base64
  credentialsPassthrough: true, // use caller identity to invoke the function
});
```

Python:

```python
# get_book_handler: lambda.Function
# get_book_integration: apigateway.LambdaIntegration

get_book_integration = apigateway.LambdaIntegration(get_book_handler,
    content_handling=apigateway.ContentHandling.CONVERT_TO_TEXT,  # convert to base64
    credentials_passthrough=True
)
```

Java:

```java
Function getBookHandler;
LambdaIntegration getBookIntegration;

LambdaIntegration getBookIntegration = LambdaIntegration.Builder.create(getBookHandler)
        .contentHandling(ContentHandling.CONVERT_TO_TEXT) // convert to base64
        .credentialsPassthrough(true)
        .build();
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Function getBookHandler;
LambdaIntegration getBookIntegration;

var getBookIntegration = new LambdaIntegration(getBookHandler, new LambdaIntegrationOptions {
    ContentHandling = ContentHandling.CONVERT_TO_TEXT,  // convert to base64
    CredentialsPassthrough = true
});
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var getBookHandler Function
var getBookIntegration LambdaIntegration

getBookIntegration := apigateway.NewLambdaIntegration(getBookHandler, &LambdaIntegrationOptions{
	ContentHandling: apigateway.ContentHandling_CONVERT_TO_TEXT,
	 // convert to base64
	CredentialsPassthrough: jsii.Boolean(true),
})
```

## Members

| Member | Description |
| --- | --- |
| `CONVERT_TO_BINARY` | Converts a request payload from a base64-encoded string to a binary blob. |
| `CONVERT_TO_TEXT` | Converts a request payload from a binary blob to a base64-encoded string. |

## Referenced by

- [`IntegrationOptions`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.IntegrationOptions.html).contentHandling
- [`IntegrationResponse`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.IntegrationResponse.html).contentHandling
