httputil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ProjectName = "search"

ProjectName is the name of this project, used for CLI client detection

Variables

This section is empty.

Functions

func GetPreferredFormat

func GetPreferredFormat(r *http.Request) string

GetPreferredFormat returns the preferred response format based on client type Per AI.md PART 14: Content Negotiation Priority

func IsBrowser

func IsBrowser(r *http.Request) bool

IsBrowser detects if the request is from a regular browser Regular browsers get full HTML with JavaScript Per AI.md PART 14: Client Type Detection & Response

func IsHttpTool

func IsHttpTool(r *http.Request) bool

IsHttpTool detects HTTP tools (curl, wget, httpie, etc.) HTTP tools are NON-INTERACTIVE - they just dump output Per AI.md PART 14: Client Type Detection & Response

func IsNonInteractiveClient

func IsNonInteractiveClient(r *http.Request) bool

IsNonInteractiveClient detects non-interactive clients (HTTP tools) These clients just dump output and don't interact with forms Per AI.md PART 14: Non-interactive tools get pre-formatted text

func IsOurCliClient

func IsOurCliClient(r *http.Request) bool

isOurCliClient detects our own CLI client Our CLI is INTERACTIVE (TUI/GUI) - receives JSON, renders itself Per AI.md PART 14: Client Type Detection & Response

func IsTextBrowser

func IsTextBrowser(r *http.Request) bool

IsTextBrowser detects text-mode browsers (lynx, w3m, links, etc.) Text browsers are INTERACTIVE but do NOT support JavaScript They receive no-JS HTML alternative (server-rendered, standard form POST) Per AI.md PART 14: Client Type Detection & Response

Types

type ClientType

type ClientType int

DetectClientType returns the type of client making the request Per AI.md PART 14: Client Type Detection & Response

const (
	ClientTypeUnknown     ClientType = iota
	ClientTypeBrowser                // Regular browser - gets full HTML with JS
	ClientTypeTextBrowser            // Text browser (lynx, w3m) - gets HTML without JS
	ClientTypeHttpTool               // HTTP tool (curl, wget) - gets formatted text
	ClientTypeOurCLI                 // Our CLI client - gets JSON
	ClientTypeAPI                    // API client - gets JSON
)

func DetectClientType

func DetectClientType(r *http.Request) ClientType

DetectClientType determines the type of client from the request Per AI.md PART 14: Client Type Detection & Response

func (ClientType) String

func (c ClientType) String() string

String returns the string representation of ClientType

Jump to

Keyboard shortcuts

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