cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

HTTP request trigger - requiring Content-Type

Hi all,

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?  

 

Thanks!

3 REPLIES 3
v-yuazh-msft
Community Support
Community Support

Hi @Anonymous,

 

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.

 

Best regards,

Alice

Anonymous
Not applicable

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!

Cheers,

Shane

Hi @Anonymous,

 

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.

 

Best regards,

Alice

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Top Solution Authors
Users online (2,445)