Home / Function/ followExpectedRedirect() — astro Function Reference

followExpectedRedirect() — astro Function Reference

Architecture documentation for the followExpectedRedirect() function in actions.test.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  9d3abc4a_37a9_df92_2612_33379606e37e["followExpectedRedirect()"]
  9dc246d5_3c0e_e5e2_ef27_d14871c178d5["actions.test.js"]
  9d3abc4a_37a9_df92_2612_33379606e37e -->|defined in| 9dc246d5_3c0e_e5e2_ef27_d14871c178d5
  style 9d3abc4a_37a9_df92_2612_33379606e37e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/actions.test.js lines 642–656

async function followExpectedRedirect(req, app) {
	const redirect = await app.render(req, { addCookieHeader: true });
	assert.ok(
		REDIRECT_STATUS_CODES.includes(redirect.status),
		`Expected redirect status, got ${redirect.status}`,
	);

	const redirectUrl = new URL(redirect.headers.get('Location'), req.url);
	const redirectReq = new Request(redirectUrl, {
		headers: {
			Cookie: redirect.headers.get('Set-Cookie'),
		},
	});
	return app.render(redirectReq);
}

Subdomains

Frequently Asked Questions

What does followExpectedRedirect() do?
followExpectedRedirect() is a function in the astro codebase, defined in packages/astro/test/actions.test.js.
Where is followExpectedRedirect() defined?
followExpectedRedirect() is defined in packages/astro/test/actions.test.js at line 642.

Analyze Your Own Codebase

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

Try Supermodel Free