Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Updating status code references #388

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/tutorial/01-svelte/common/src/routes/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
code
<a
target="_blank"
href="https://httpstatusdogs.com/{$page.status}"
href="https://http.dog/{$page.status}"
>{$page.status}</a
>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
code
<a
target="_blank"
href="https://httpstatusdogs.com/{$page.status}"
href="https://http.dog/{$page.status}"
>{$page.status}</a
>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function POST({ request, cookies }) {

As with `load` functions and form actions, the `request` is a standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object; `await request.json()` returns the data that we posted from the event handler.

We're returning a response with a [201 Created](https://httpstatusdogs.com/201-created) status and the `id` of the newly generated todo in our database. Back in the event handler, we can use this to update the page:
We're returning a response with a [201 Created](https://http.dog/201) status and the `id` of the newly generated todo in our database. Back in the event handler, we can use this to update the page:

```svelte
/// file: src/routes/+page.svelte
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function DELETE({ params, cookies }) {
}
```

Since we don't need to return any actual data to the browser, we're returning an empty [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) with a [204 No Content](https://httpstatusdogs.com/204-no-content) status.
Since we don't need to return any actual data to the browser, we're returning an empty [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) with a [204 No Content](https://http.dog/204) status.

We can now interact with this endpoint inside our event handlers:

Expand Down