apiresponse

package
v1.166.4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package apiresponse holds the API gateway's rules for an upstream response: which bodies are safe to return inline, and which headers reach the caller. Moved out of pkg/toolkits/apigateway for its size budget.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Headers

func Headers(h http.Header) map[string][]string

Headers is the subset of h in the passthrough set, nil when none.

func Inlineable

func Inlineable(contentType string) bool

Inlineable reports whether a response with this Content-Type is safe to buffer and return inline through the MCP/JSON channel. Text-shaped bodies (text/*, JSON, XML, form, JavaScript) are inlineable: JSON-escaping them is roughly size-preserving. Binary bodies (application/zip, application/octet-stream, image/*, audio/*, video/*, application/pdf, ...) are NOT: json.Marshal escapes every control and invalid-UTF-8 byte as \uXXXX, inflating a high-entropy body several-fold, and the escaped copy is held alongside the raw buffer and the re-marshaled MCP envelope. Returning such a body inline both risks an OOM and is useless to the model. The gateway refuses those before buffering and steers the caller to api_export.

An empty or unparseable Content-Type returns true so the legacy buffered path (bounded by the per-request read cap) is unchanged for responses that declare no usable type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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