Standard content template for mapping template

I work with a data provider for my project, which, unfortunately, does not adhere to any standards, so the type of content is not indicated in the request header. This is actually indicated, but with a different key, and then the contents.

The POST request payload is in xml format, so as far as I understand, we need to use the mapping template to transfer the payload to the json object. All this works fine when we specify the content type as one of the established types in the integration request part.

Now, as I understand it, if the content type is not specified in the request header, it should use "application / json" by default and use a mapping template with this type. In our case, it behaves in the same way as it ignores the matching pattern, which, in turn, leads to the following error:

{"Type": "User", "message": "Failed to parse the request body in json." }

Just indicate that the request is being sent for processing on AWS Lambda.

Any ideas on how we can do this?

Edit: I confirmed that "application / json" is used by default if the Content-Type is not specified in the header. In this case, I assume that I am experiencing an error.

+4

Source: https://habr.com/ru/post/1609656/


All Articles