Azure / Azure/azure-functions-host
Content is returned as { type: 'Buffer', data: [...] } with $return binding
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
With
```js
import { readBuffer } from '@wrote/read' // returns a buffer
export default async () => {
const body = await readBuffer('style.css')
context.res = {
body,
headers: {
'content-type': 'text/css',
},
}
}
```
and bindings
```json
{
"disabled": false,
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"route": "style.css",
"direction": "in",
"name": "req",
"methods": [
"get"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
}
]
}
```
my CSS file is served properly. When I change the bindings to use `$return`, I get served a buffer in serialised format:
```json
{
"type": "http",
"direction": "out",
"name": "$return"
}
```
```js
import { readBuffer } from '@wrote/read' // returns a buffer
export default async () => {
const body = await readBuffer('style.css')
return {
body,
headers: {
'content-type': 'text/css',
},
}
}
```
```
{"type":"Buffer","data":[46,103,111,111]}
```
---
Azure Functions Core Tools (2.1.748 Commit hash: 5db20665cf0c11bedaffc96d81c9baef7456acb3)
Function Runtime Version: 2.0.12134.0
Contributor guide
Research direction
Start by reproducing the shown Azure Functions HTTP response with the direct res binding and then with the $return binding, using the same Buffer content and CSS content type. Done means the $return response serves the Buffer as CSS content instead of exposing a serialized {"type":"Buffer","data":[...]} value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100