Aerostack
search

web-headers-parse Edge Function — Web Search

Web Search

Parse a raw HTTP header block string or object into a structured lowercase-keyed object with content-type and authorization extraction.

navin @navin verified
Updated Mar 12, 2026
GitHub

Edge function web-headers-parse Parse a raw HTTP header block string or object into a structured lowercase-keyed object with content-type and authorization extraction.. 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-headers-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-headers-parse",
  args: {
    "headers": null
  }
})

web-headers-parse — Parse HTTP headers into structured object

Normalize raw HTTP headers (string or object) into a lowercase-keyed object with automatic content-type and authorization extraction.


API

POST /api/web-headers-parse

Request body

Field Type Required Description
headers string | object Yes Raw header block string or key-value object

Success response (200)

{
  "success": true,
  "data": {
    "headers": {
      "content-type": "application/json",
      "authorization": "Bearer token123"
    },
    "count": 2,
    "contentType": "application/json",
    "authorization": { "scheme": "Bearer", "credentials": "token123" }
  }
}

Error responses

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

Usage

Direct import
import { webHeadersParse } from '@aerostack/functions/web-headers-parse';

const result = webHeadersParse({
  headers: 'Content-Type: application/json\r\nAuthorization: Bearer mytoken',
});
console.log(result.authorization); // { scheme: 'Bearer', credentials: 'mytoken' }

Use Cases

  • Normalizing headers from different HTTP frameworks for unified processing
  • Extracting and inspecting Authorization tokens in middleware
  • Logging or auditing request headers in a structured format

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-headers-parse function do? +

web-headers-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-headers-parse function? +

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

What runtime does web-headers-parse use? +

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

Can I customise the web-headers-parse function? +

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