# Override accept headers

The OpenAPI specification makes it easy to use the `content` directive to specify which endpoints in an API support multiple content types.

In this example, our get-all-users endpoint can return a response encoded either as unstructured `text/plain` data or as a structured `application/json` document.

```yaml
/getall:
  get:
    operationId: getAll
    tags:
      - users
    responses:
      "200":
        description: OK
        content:
          text/plain:
            schema:
              type: string
          application/json:
            schema:
              type: string
```

When invoking the operation normally, the Speakeasy SDK automatically defaults to the first option in the list, in this case, `text/plain`.

For any API operations that specify multiple accept headers in the OpenAPI specification, the Speakeasy SDK provides a mechanism to override the accept header to receive data in the preferred format.

## Accept Header Override in Go

In Go, all types from all operations are collected into a global `AcceptHeaderEnum` type that can be found in `sdk/operations/options.go`.

```go
type AcceptHeaderEnum string

const (
	AcceptHeaderEnumApplicationJson        AcceptHeaderEnum = "application/json"
	AcceptHeaderEnumTextPlain              AcceptHeaderEnum = "text/plain"
)
```

Invoking the `WithAcceptHeaderOverride` function with the appropriate `AcceptHeaderEnum` creates the optional parameter to pass to the operation:

```go
s := sdk.New()
ctx := context.Background()
res, err := s.Users.GetAll(ctx, operations.WithAcceptHeaderOverride(operations.AcceptHeaderEnumApplicationJSON))
```

## Accept Header Override in Python and TypeScript

In Python and TypeScript, each operation with multiple specified accept headers will have an enum created that provides the acceptable options. The name of the enum will be the tag name, followed by the operation name, followed by `AcceptEnum`. For the example above, that would be `UsersGetAllAcceptEnum`.

## Unspecified Accept Headers

While it is strongly recommended to add all accept headers to the OpenAPI spec, in Go, it is possible to override the accept header to an unspecified value.

```go
s := sdk.New()
ctx := context.Background()
res, err := s.Users.GetAll(ctx, operations.WithAcceptHeaderOverride("application/json+debug"))
```

There is no support for unspecified accept headers in Python or TypeScript.
