Skip to main content

Notifications

Power Automate - Using Connectors
Answered

Custom Connector: Header "content-type" not sent to service

(0) ShareShare
ReportReport
Posted on by 61

I would like to connect to an RestAPI-Service, which needs the header information:

"content-type": "application/x-www-form-urlencoded"
but have problems using it as well in Flow as in PowerApps Smiley Sad
Error code/status is 415:    Unsupported Media Type     Content type '' not supported
 
To reproduce the problem, I tested it with the Postman Echo Server and two header keys: "content-type" and "MyContentType":
In Postman both Key/Value are echoed:
 
Postman.jpg

 

I generate a custom connector with these two header parameters

 

CustomConnector.jpg

and the default response 200:

Response200.jpg

 

The custom connector test shows no error and no problem: both keys are in the response:

CustomConnectorTest.jpg

 

Problem:

If I use it in a Flow "content-type" is missing, only "MyContentType" is accessable:

FlowTest.jpg

 

I've testet the runtime server input: both parameters are transfered to the azure platform

{
 "method":"post",
 "headers":{
 "Content-Type":"application/x-www-form-urlencoded",
 "MyContentType":"application/x-www-form-urlencoded"
 },
 "path":"/post",
 "host":
 {
 "api":
 {
 "runtimeUrl":"https://europe-002.azure-apim.net/apim/flowposttest-5f7e5f68ae5b1cf2d2-5f79e327c051ec9794"
 },
 "connection":
 {"name":"/providers/Microsoft.PowerApps/apis/shared_flowposttest-5f7e5f68ae5b1cf2d2-5f79e327c051ec9794/connections/e38ffb06-9eb2-451d-a51a-5509-8628e957"
 }
 },
 "authentication":
 {
 "scheme":"Key",
 "parameter":"*sanitized*",
 "type":"Raw"
 }
}

Why is the Azure Server deleting the "content-type" parameter?

  • jackp514 Profile Picture
    jackp514 47 on at
    Re: Custom Connector: Header "content-type" not sent to service

    To any one still struggling with this issue, none of these solutions fixed the error for me. The only thing that worked was putting SOMETHING in the "body"

     

    If you put "{ }" in the body it seems to work now.

  • derb Profile Picture
    derb 30 on at
    Re: Custom Connector: Header "content-type" not sent to service

    Thank you sooo much!  You solved my problem with my custom connector that I could not figure out! Virtual hugs and joy! I have been trying to modify the URL by changing the sample input for about an hour without success... This worked like a charm!

  • Verified answer
    Frank37 Profile Picture
    Frank37 61 on at
    Re: Custom Connector: Header "content-type" not sent to service

    Here is the solution from GonzaloR (worked for me 👍)

     

    https://powerusers.microsoft.com/t5/General-Power-Automate/Custom-connector-action-with-x-www-form-u...

     

    1. Click "New Policy"
    2. Name your policy
    3. Select "Set HTTP header"
    4. Select the Operations (Actions) that require this header
    5. Header name: "content-type"
    6. Header Value: "application/x-www-form-urlencoded"
    7. Action if header exists: "override"
    8. Run policy on: "Request"

     

  • Frank37 Profile Picture
    Frank37 61 on at
    Re: Custom Connector: Header "content-type" not sent to service

    Hi Alice,

     

    yes, "content-type" is defined for the output of the custom connector, but only to show, that the azure platform is deleting the HTTP-header-parameter  "content-type"

     

    IT's not possible to add a Compose Action, which changes the HTTP-header of the custom connector action. You can only change the url parameters.

     

    Here is a sample Swagger-File for a custom connector (OpenAPI)

     

    If using the custom connector test funktion, the "content-type" header-parameter is sent to the server (and echoed in the reply).

    If using this connector in flow (or PowerApps), the azure platform deletes the  "content-type" header-parameter (why?) and in the echo reply the parameter is missing

     

    {
     "swagger": "2.0",
     "info": {
     "description": "Postman Echo Server",
     "version": "0.1",
     "title": "MyTest2"
     },
     "host": "postman-echo.com",
     "basePath": "/",
     "schemes": [
     "https"
     ],
     "consumes": [],
     "produces": [],
     "paths": {
     "/post": {
     "post": {
     "consumes": [
     "application/x-www-form-urlencoded"
     ],
     "produces": [
     "application/json"
     ],
     "parameters": [
     {
     "name": "Content-Type",
     "in": "header",
     "required": true,
     "type": "string",
     "default": "application/x-www-form-urlencoded",
     "x-ms-visibility": "internal"
     },
     {
     "name": "MyContentType",
     "in": "header",
     "required": true,
     "type": "string",
     "default": "application/x-www-form-urlencoded",
     "x-ms-visibility": "internal"
     }
     ],
     "responses": {
     "200": {
     "description": "default",
     "schema": {
     "type": "object",
     "properties": {
     "url": {
     "type": "string",
     "description": "url"
     },
     "headers": {
     "type": "string",
     "description": "MyContentType"
     },
     "Content-Type": {
     "type": "string",
     "description": "Content-Type"
     }
     }
     }
     }
     },
     "summary": "Echo Server Test",
     "description": "Echo Server Test",
     "operationId": "EchoServerTest"
     }
     }
     },
     "parameters": {},
     "responses": {},
     "securityDefinitions": {},
     "security": [],
     "tags": []
    }
  • Re: Custom Connector: Header "content-type" not sent to service

    Hi @Frank37 ,

     

    Have you created the "content-type" for the output of the custom connector?

    Could you please take a try to add a Compose action under custom connector, and check if you could add am expression or a dynamic content for the "content-type"?

     

    Best regards,

    Alice       

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,636

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,942

Leaderboard

Featured topics