summaryrefslogtreecommitdiff
path: root/.changeset/yellow-tips-cover.md
blob: fb373374ef11ced3c214ff88255beca8a463faee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
'astro': patch
---

Deprecate returning simple objects from endpoints. Endpoints should only return a `Response`.

To return a result with a custom encoding not supported by a `Response`, you can use the `ResponseWithEncoding` utility class instead.

Before:

```ts
export function GET() {
  return {
    body: '...',
    encoding: 'binary',
  };
}
```

After:

```ts
export function GET({ ResponseWithEncoding }) {
  return new ResponseWithEncoding('...', undefined, 'binary');
}
```