onRequest() — astro Function Reference
Architecture documentation for the onRequest() function in integration-middleware-post.js from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 838501db_e9ad_ad9d_7599_2006532b996f["onRequest()"] ec2d359d_30c1_509c_ac7d_6ea3aa0dae9c["integration-middleware-post.js"] 838501db_e9ad_ad9d_7599_2006532b996f -->|defined in| ec2d359d_30c1_509c_ac7d_6ea3aa0dae9c style 838501db_e9ad_ad9d_7599_2006532b996f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/test/fixtures/middleware space/integration-middleware-post.js lines 3–17
export const onRequest = defineMiddleware((context, next) => {
if (context.url.pathname === '/integration-post') {
return new Response(JSON.stringify({ post: 'works' }), {
headers: {
'content-type': 'application/json',
},
});
}
if (context.url.pathname === '/does-not-exist') {
return context.rewrite('/rewrite');
}
return next();
});
Domain
Subdomains
Source
Frequently Asked Questions
What does onRequest() do?
onRequest() is a function in the astro codebase, defined in packages/astro/test/fixtures/middleware space/integration-middleware-post.js.
Where is onRequest() defined?
onRequest() is defined in packages/astro/test/fixtures/middleware space/integration-middleware-post.js at line 3.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free