web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / HTTP request trigger -...
Power Automate
Unanswered

HTTP request trigger - requiring Content-Type

(0) ShareShare
ReportReport
Posted on by

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!

Categories:
I have the same question (0)
  • v-yuazh-msft Profile Picture
    on at
    Re: HTTP request trigger - requiring Content-Type

    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

  • Community Power Platform Member Profile Picture
    on at
    Re: HTTP request trigger - requiring Content-Type

    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

  • v-yuazh-msft Profile Picture
    on at
    Re: HTTP request trigger - requiring Content-Type

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard