Markive
Markive

Reputation: 2400

Azure Logic App - Receive file from http request

I have an ASP.Net handler that returns a PDF report. I want the Azure Logic App to request the file and then add it to an e-mail as an attachment.

When I try to do this through an HTTP request I get the following error:

BadRequest. Http request failed as there is an error: 'Error while copying content to a stream.'

If I make the request with a browser I get a HTTP 200 response and it works. See request/response headers from chrome and fiddler.

I'm sure I could solve this with an Azure Function to get the file blob and pass it to the e-mail stage but it appears in the documentation that Logic Apps can handle streams and base64 encode. Am I missing something here?

chrome network tab

Upvotes: 1

Views: 5135

Answers (1)

AdAstra
AdAstra

Reputation: 1984

I tried with the following a static result in an HTTP request to mimic the HTTP request/stream as much as possible. I guess it comes down to that you need to design the body of the stream in a way the includes content and content-type like I did below with my mockup HTTP request

static request

pdf content

static request setup1

content-type: application/pdf and application/octet-stream worked static request setup2

Send and email action:

enter image description here

Sent email result

Outlook result:

enter image description here

Upvotes: 2

Related Questions