header

package
v1.0.1 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: 2 modules, 1 package

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.

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