httplines

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package httplines normalizes HTTP header input from APIs and MCP tools. Agents often pass headers as a JSON object; humans use "Key: Value" lines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeArg

func NormalizeArg(v any) (map[string][]string, error)

NormalizeArg is the MCP/API helper: string lines, JSON object map, or empty.

func NormalizeCRLF

func NormalizeCRLF(s string) string

NormalizeCRLF converts LF-only newlines to CRLF (Burp-style raw editor).

func NormalizeJSON

func NormalizeJSON(raw json.RawMessage) (map[string][]string, error)

NormalizeJSON accepts JSON null, a "Key: Value\n…" string, or a {"Key":"Value"} object.

func ParseRawRequest

func ParseRawRequest(raw string) (method, path string, headers map[string][]string, body []byte, err error)

ParseRawRequest parses a raw HTTP request (request line + headers + body after a blank line). Content-Length is dropped — callers recompute it from the body.

func ToLines

func ToLines(h map[string][]string) string

ToLines renders a header map as "Key: Value" lines (sorted by key).

func ToMap

func ToMap(s string) map[string][]string

ToMap parses raw "Key: Value" lines into a header map.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL