Skip to content

Commit

Permalink
feat(ef templates): replace context.json with Response.json (#5342)
Browse files Browse the repository at this point in the history
* feat(ef templates): replace context.json with Response.json

* feat: use context object

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
Skn0tt and kodiakhq[bot] authored Jan 3, 2023
1 parent 7eb4479 commit 89b14e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/functions-templates/typescript/geolocation/{{name}}.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default async (request: Request, context: Context) => {
// }
// }

return context.json({
return Response.json({
geo: context.geo,
header: request.headers.get("x-nf-geo"),
});
Expand Down
2 changes: 1 addition & 1 deletion src/functions-templates/typescript/json/{{name}}.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Context } from "https://edge.netlify.com";

export default async (request: Request, context: Context) => {
return context.json({ hello: "world" });
return Response.json({ hello: "world", location: context.geo.city });
};

1 comment on commit 89b14e2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

  • Package size: 249 MB

Please sign in to comment.