I would like to connect to an RestAPI-Service, which needs the header information:
"content-type": "application/x-www-form-urlencoded"
I generate a custom connector with these two header parameters
and the default response 200:
The custom connector test shows no error and no problem: both keys are in the response:
Problem:
If I use it in a Flow "content-type" is missing, only "MyContentType" is accessable:
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?
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.
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!
Here is the solution from GonzaloR (worked for me 👍)
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": []
}
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.