mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
27 lines
489 B
Markdown
27 lines
489 B
Markdown
|
---
|
||
|
'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');
|
||
|
}
|
||
|
```
|