Home / Function/ onRequest() — astro Function Reference

onRequest() — astro Function Reference

Architecture documentation for the onRequest() function in middleware.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  63a1c8d6_af33_dabe_4fe7_25f8d79f61e5["onRequest()"]
  858ffdc2_1c79_d604_e90e_a28abaf9f20b["middleware.js"]
  63a1c8d6_af33_dabe_4fe7_25f8d79f61e5 -->|defined in| 858ffdc2_1c79_d604_e90e_a28abaf9f20b
  style 63a1c8d6_af33_dabe_4fe7_25f8d79f61e5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/vercel/test/fixtures/middleware-with-edge-file/src/middleware.js lines 8–14

export const onRequest = async (context, next) => {
	const test = 'something';
	context.cookies.set('foo', 'bar');
	const response = await next();
	response.headers.set('x-message', message);	
	return response;
};

Domain

Subdomains

Frequently Asked Questions

What does onRequest() do?
onRequest() is a function in the astro codebase, defined in packages/integrations/vercel/test/fixtures/middleware-with-edge-file/src/middleware.js.
Where is onRequest() defined?
onRequest() is defined in packages/integrations/vercel/test/fixtures/middleware-with-edge-file/src/middleware.js at line 8.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free