Aerostack
search

web-content-type-parse Edge Function — Web Search

Web Search

Parse a Content-Type header value into MIME type, subtype, charset, boundary, and convenience boolean flags.

navin @navin verified
Updated Mar 12, 2026
GitHub

Edge function web-content-type-parse Parse a Content-Type header value into MIME type, subtype, charset, boundary, and convenience boolean flags.. Deployed on Cloudflare Workers — zero cold starts, globally distributed. Mount it via your Aerostack workspace to call it from any AI agent.

terminal — aerostack cli
$ npx aerostack add navin/web-content-type-parse
smart_toy

Use with AI Assistants

MCP

Connect Claude, Cursor, or any MCP-compatible client — then call this function by slug

① Add MCP Server

Add this once — access all Aerostack functions from your AI tool.

claude_desktop_config.json
{
  "mcpServers": {
    "aerostack": {
      "url": "https://mcp.aerostack.dev",
      "type": "http"
    }
  }
}

② Call this function

Ask your AI to use the call_function tool with this slug:

call_function
call_function({
  slug: "web-content-type-parse",
  args: {
    "contentType": "example_contentType"
  }
})

web-content-type-parse — Parse Content-Type header

Decompose a Content-Type header value into MIME type components with convenience flags for JSON, HTML, multipart, and text detection.


API

POST /api/web-content-type-parse

Request body

Field Type Required Description
contentType string Yes Content-Type header value

Success response (200)

{
  "success": true,
  "data": {
    "mimeType": "application/json",
    "type": "application",
    "subtype": "json",
    "charset": "utf-8",
    "boundary": null,
    "parameters": { "charset": "utf-8" },
    "isJson": true,
    "isHtml": false,
    "isMultipart": false,
    "isText": false
  }
}

Error responses

Code HTTP When
INVALID_INPUT 400 Missing contentType field
INTERNAL_ERROR 500 Unexpected error

Usage

Direct import
import { webContentTypeParse } from '@aerostack/functions/web-content-type-parse';

const result = webContentTypeParse({ contentType: 'multipart/form-data; boundary=----abc' });
console.log(result.isMultipart); // true
console.log(result.boundary);    // '----abc'

Use Cases

  • Routing request handling logic based on incoming Content-Type
  • Validating that API requests send JSON before attempting to parse the body
  • Extracting multipart boundaries for form data processing

Metadata

upgrade Version 1.0.0
gavel License MIT
language Language typescript
cloud Provider aerostack

Tags

web
deployed_code

Build and publish your own functions

Write a TypeScript function, deploy it to the edge, and share it with thousands of developers — in minutes.

More Web Search Functions

Browse Web Search Functions →

Frequently asked questions

What does the web-content-type-parse function do? +

web-content-type-parse is a serverless edge function for web-search automation written in aerostack. Deploy it to Cloudflare Workers via your Aerostack workspace.

How do I deploy the web-content-type-parse function? +

Install the Aerostack CLI and run: ```bash aerostack deploy function @navin/web-content-type-parse ``` It will be live on Cloudflare Workers in seconds.

What runtime does web-content-type-parse use? +

web-content-type-parse runs on aerostack on the Cloudflare Workers edge runtime — zero cold starts, globally distributed.

Can I customise the web-content-type-parse function? +

Yes. Fork the function from your Aerostack dashboard, modify the source, and redeploy. All changes are version-controlled.