Home / Function/ hasContentType() — astro Function Reference

hasContentType() — astro Function Reference

Architecture documentation for the hasContentType() function in server.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  d1eef9a9_8a0f_eb02_6578_097c5ac98e0f["hasContentType()"]
  12df90c3_b0fe_d858_b821_5011b6067fdb["server.ts"]
  d1eef9a9_8a0f_eb02_6578_097c5ac98e0f -->|defined in| 12df90c3_b0fe_d858_b821_5011b6067fdb
  d2a22336_a5ee_9bc2_8056_2770db2de333["parseRequestBody()"]
  d2a22336_a5ee_9bc2_8056_2770db2de333 -->|calls| d1eef9a9_8a0f_eb02_6578_097c5ac98e0f
  style d1eef9a9_8a0f_eb02_6578_097c5ac98e0f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/actions/runtime/server.ts lines 271–277

function hasContentType(contentType: string, expected: string[]) {
	// Split off parameters like charset or boundary
	// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type#content-type_in_html_forms
	const type = contentType.split(';')[0].toLowerCase();

	return expected.some((t) => type === t);
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does hasContentType() do?
hasContentType() is a function in the astro codebase, defined in packages/astro/src/actions/runtime/server.ts.
Where is hasContentType() defined?
hasContentType() is defined in packages/astro/src/actions/runtime/server.ts at line 271.
What calls hasContentType()?
hasContentType() is called by 1 function(s): parseRequestBody.

Analyze Your Own Codebase

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

Try Supermodel Free