cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Microsoft Flow is not adding the Accept Header but OpenAPI specifies proper "produces" value

Everything I've been reading suggests that if the OpenAPI / Swagger file specifies a value for "prod...

 

However, I have the following OpenAPI file, which to me says I should be getting an "Accept" header on the request of "application/pdf":

{
  "swagger": "2.0",
  "info": {
    "title": "Accounting API",
    "version": "2.0"
  },
  "host": "MyWebSite",
  "basePath": "/api",
  "schemes": [
    "https"
  ],
  "paths": {
    "/Invoices/{InvoiceID}": {
      "get": {
        "summary": "getInvoice - Allows you to retrieve any sales invoices or purchase bills",
        "operationId": "getInvoice",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/pdf"
        ],
        "parameters": [
          {
            "required": true,
            "in": "path",
            "name": "InvoiceID",
            "type": "string",
            "format": "uuid"
          }
        ],
        "responses": {
          "200": {
            "description": "A successful request",
            "schema": {
              "$ref": "#/definitions/Invoice"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ]
      }
    }
  },
  "securityDefinitions": {
    "basicAuth": {
      "type": "basic"
    }
  },
  "definitions": {

. . . TRUNCATED . . .

When I dump all the headers in my Azure Function which is called by the Microsoft Flow there is not an "Accept" header set. As a result the web service does not return PDF content.

 

Does anybody know how to get Microsoft Flow to pass that information?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Advocate I
Advocate I

Re: Microsoft Flow is not adding the Accept Header but OpenAPI specifies proper "produces"

This appears to be a bug. Based on everything I'm reading on how the OpenAPI specifications should be set the "produces" header should be set as the "Accept" header on any requests. Microsoft Flow does not do this.

 

As a work around you can specify a header parameter for "Accept" and then define that in my flow:

"parameters": [
{
"required": true,
"in": "header",
"name": "accept",
"type": "string"
}
]

 

As a result I have something working, but Microsoft should take a look at this and fix the behavior of Microsoft Flow to match the expected behavior.

View solution in original post

2 REPLIES 2
Highlighted
Advocate I
Advocate I

Re: Microsoft Flow is not adding the Accept Header but OpenAPI specifies proper "produces"

This appears to be a bug. Based on everything I'm reading on how the OpenAPI specifications should be set the "produces" header should be set as the "Accept" header on any requests. Microsoft Flow does not do this.

 

As a work around you can specify a header parameter for "Accept" and then define that in my flow:

"parameters": [
{
"required": true,
"in": "header",
"name": "accept",
"type": "string"
}
]

 

As a result I have something working, but Microsoft should take a look at this and fix the behavior of Microsoft Flow to match the expected behavior.

View solution in original post

Highlighted
Community Support
Community Support

Re: Microsoft Flow is not adding the Accept Header but OpenAPI specifies proper "produces"

Hi @DougL,

 

Thanks for the feedback.

 

Regards,

Michael

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

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (5,756)