简体   繁体   中英

Azure APIM validating base64 encoded text when passing Content-Type as application/json?

I have an API operation defined on Azure APIM that accepts json payload. The payload comprises of, among other attributes, an attribute which has a document in form of a base64 encoded string. For certain payloads, which might potentially have invalid characters in the base64 encoded string, the APIM throws error 403 if the Content-Type header to "application/json". If the Content-type header is removed, it works fine.

My question is: Does APIM run any sort of validation on the payload if a content type is set? And if so, is there a way to get around that?

In most simple way APIM does not care about your payload at all. Do you have any policies in place? Some policies and policy expressions will try to read your body and may fail if request says that it's JSON, while it's not.

If possible, try to repro it in test console in Azure portal, trace tab there will show you the source of error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM