Request Accept header '*;q=.2' is not a valid media type

Hi,

I am getting the error below while using OAS Validation policy.

Header in Request which is causing the issue:

Accept text/html,image/gif,image/jpeg,;q=.2,/*;q=.2

Error:

OASValidation OpenAPI-Spec-Validation with resource "oas://Sample.yaml": failed with reason: "[ERROR - Request Accept header ‘*;q=.2’ is not a valid media type: ]"",

Tried using the below configuration to bypass this error, but this doesn’t help.

I understand that the ‘Accept’ header can be modified to resolve this. However wanted to understand if there are any other ways to solve this !!

OpenAPI Spec Validation request true true oas://Sample.yaml

Thanks

If I understand correctly, it looks like a bug to me. I suggest that you contact Apigee support, they can raise a bug on your behalf.

1 Like

It is about 4 months after the question, but maybe this could help someone else.

Also, this is not a solution, but a workaround.

You can set in OASValidation the property continueOnError as “true” and add a RaiseFault component after this with condition:
Not (OASValidation.OpenAPI-Spec-Validation.fault.cause JavaRegex “.Request Accept header ‘*; q=.2’ is not a valid media type.”)

(the regex is very specific, but OASValidation always throws the error the same way, so it is pretty safe I believe)