summaryrefslogtreecommitdiff
path: root/packages/astro/test/fixtures/middleware space/integration-middleware-post.js
blob: 4cc63c6b7c49b467cb9d7ab6e4d2968f0c6aa941 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { sequence, defineMiddleware } from 'astro:middleware';

export const onRequest = defineMiddleware((context, next) => {
	if(context.url.pathname === '/integration-post') {
		return new Response(JSON.stringify({ post: 'works' }), {
			headers: {
				'content-type': 'application/json'
			}
		});
	}

	return next();
});