header

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 0 Imported by: 1

README

header — HTTP header & MIME constants

import "github.com/downsized-devs/sdk-go/header"

Stability: Stable — see STABILITY.md

Plain string constants for header keys, content types, and cache-control values. No tests; nothing to test.

Features

  • ~18 string constants (e.g. RequestID, AcceptLanguage, ContentType, CacheControl, ApplicationJSON).

Installation

go get github.com/downsized-devs/sdk-go/header

Quick Start

import "github.com/downsized-devs/sdk-go/header"

w.Header().Set(header.ContentType, header.ApplicationJSON)
lang := r.Header.Get(header.AcceptLanguage)

API Reference

See header/header.go for the full constant list. Constants only — no types or functions.

Dependencies

stdlib only.

Testing

No tests; constants are checked at compile time.

Contributing

See CONTRIBUTING.md. Add new constants alphabetically and update appcontext if the new header has a typed getter/setter.

  • appcontext — uses these constants when reading inbound headers.

Documentation

Index

Constants

View Source
const (
	// Header keys
	KeyRequestID      string = "x-request-id"
	KeyAuthorization  string = "authorization"
	KeyUserAgent      string = "user-agent"
	KeyContentType    string = "content-type"
	KeyContentAccept  string = "accept"
	KeyAcceptLanguage string = "accept-language"
	KeyCacheControl   string = "cache-control"
	KeyDeviceType     string = "x-device-type"
	KeyServiceName    string = "x-service-name"
	KeyEventType      string = "x-event-type"
	KeyEventSource    string = "x-event-source"

	// Content type. Specifying the payload in the request
	ContentTypeJSON string = "application/json"
	ContentTypeXML  string = "application/xml"
	ContentTypeForm string = "application/x-www-form-urlencoded"

	// Accepting media. Specifying the types of requested media (in the response)
	// See here: https://en.wikipedia.org/wiki/Content_negotiation
	MediaTextPlain string = "text/plain"
	MediaTextHTML  string = "text/html"
	MediaTextCSV   string = "text/csv"
	MediaTextXML   string = "text/xml"

	MediaImageGIF  string = "image/gif"
	MediaImageJPEG string = "image/jpeg"
	MediaImagePNG  string = "image/png"
	MediaImageWEBP string = "image/webp"

	// Cache control
	CacheControlNoCache string = "no-cache"
	CacheControlNoStore string = "no-store"
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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