Azure / azure-functions-dotnet-worker-preview

MIT License
65 stars 19 forks source link

[Question] How would I return an image via HttpResponseData (byte[] - images/jpeg)? #25

Closed Zettersten closed 3 years ago

Zettersten commented 3 years ago

Lets say I fetch an image using the Bing Image Search API.

It'll give me the raw stream of the image along with its content-type.

How can I turn that stream into a valid response using the HttpResponseData object?

Since "body" is the only property available and its a string, I have no idea what to do...

Zettersten commented 3 years ago

Problem solved.

Return a byte array and not HttpResponseData.

hansmbakker commented 3 years ago

How are the proper content-type headers set, then?