Skip to content

Commit

Permalink
doc: add runtime param to all recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
magne4000 committed Dec 4, 2024
1 parent cfcb34c commit b8d1146
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/tool/src/middlewares/context.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import type { Get, UniversalMiddleware } from "@universal-middleware/core";

const contextMiddleware = ((value) => (request, ctx) => {
const contextMiddleware = ((value) => (request, ctx, runtime) => {
// Return the new universal context, thus keeping complete type safety
// A less typesafe way to do the same thing would be to `ctx.something = value` and return nothing
return {
Expand Down
2 changes: 1 addition & 1 deletion examples/tool/src/middlewares/guard.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface User {
}

// This middleware will return an early Response for unauthenticated users
const guardMiddleware = (() => (request, ctx) => {
const guardMiddleware = (() => (request, ctx, runtime) => {
if (!ctx?.user) {
return new Response("Unauthorized", {
status: 401,
Expand Down
2 changes: 1 addition & 1 deletion examples/tool/src/middlewares/headers.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { Get, UniversalMiddleware } from "@universal-middleware/core";

// This middleware will add a `X-Universal-Hello` header to all responses
const headersMiddleware = (() => (request, ctx) => {
const headersMiddleware = (() => (request, ctx, runtime) => {
return (response) => {
// `ctx.hello` exists if it has been set by another middleware
response.headers.set("X-Universal-Hello", ctx.hello ?? "world");
Expand Down

0 comments on commit b8d1146

Please sign in to comment.