I am building a flow where I would like to require a specific content-type in the http header.
If I build an expression which checks the content-type, it works fine if the header exists, but if it *does not* exist, the flow the fails with "invalid template" because the triggeroutputs()['headers']['content-type'] does not exist. HTTP 500 is returned with "bad gateway", but I want the flow to fail more gracefully instead (return HTTP 415 - Unsupported media type to the client).
I tried to catch this error by setting a variable to the Content-Type and then different "Run after" actions but the flow does not reach that point, the invalid template error just terminates the flow.
Does anyone know a way that I can trap this error and prevent the flow failing?
The "Run after" would only work after actions, and the "Run after" doesn't work after a trigger.
I afraid that there is no any way to achieve your requirement in microsoft flow currently.
Thanks for the reply.
The flow does not fail in the trigger itself, but when I use a condition in the flow to check for the Content-Type header in a condition
@@triggeroutputs()?['Headers']['Content-Type'] . If the Content-Type is not specified in the https request, the "Invalid Template" error occurs. But this seems to fail the entire flow and return an http 500 response rather than execute the "Run After".
Is that the expected behaviour ?
Many thanks for your help!
It is the expected behaviour for "Invalid Template" error if the Content-Type is not specified in the https request.
Please make sure you have specified the Content-Type in the https request.
Check out the News & Announcements to learn more.
Check out the new Power Platform Community Connections gallery!
Congratulations, the new Super User Season 2 for 2021 has started!
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.