Header 'Content-Type' of an encoding object is ignored

Description

You have included Content-Type in the headers field of your encoding object. However, for encoding objects, Content-Type is defined separately and is ignored inside the headers field.

For more details, see the OpenAPI Specification.

Example

The following is an example of how this issue could look in your API definition:

1encoding:
2  historyMetadata:
3    contentType: application/xml; charset=utf-8
4  profileImage:
5    headers:
6      Content-Type:
7        contentType: image/png, image/jpeg
8      X-Rate-Limit-Limit:
9        description: The number of allowed requests in the current period
10        schema:
11          type: integer
12

Remediation

Make sure that you define Content-Type separately, and not in the headers field.

1encoding:
2  historyMetadata:
3    contentType: application/xml; charset=utf-8
4  profileImage:
5    contentType: image/png, image/jpeg
6    headers:
7      X-Rate-Limit-Limit:
8        description: The number of allowed requests in the current period
9        schema:
10          type: integer
11          additionalProperties: false
12

Copyright 42Crunch 2021