Package ctype provides tools for working with the HTTP Content-Type header, for the Go programming language.
Find a file
2025-09-05 06:30:32 -07:00
go.mod go.* 2025-09-04 19:37:04 -07:00
go.sum go.* 2025-09-04 19:37:04 -07:00
LICENSE initial commits 2025-09-04 18:51:36 -07:00
mediatype.go ctype.MediaType() 2025-09-05 06:29:50 -07:00
mediatype_test.go ctype.MediaType() 2025-09-05 06:30:32 -07:00
README.md initial commits 2025-09-04 18:51:36 -07:00

go-ctype

Package ctype provides tools for working with the HTTP Content-Type header, for the Go programming language.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-ctype

GoDoc

Example

Here is an example of getting the normalized media-type from a Content-Type.

import "codeberg.org/reiver/go-ctype"

// ...

contentType := response.Header.Get("Content-Type")
// contentType == "TEXT/HTML; charset=utf-8"

mediaType := ctype.MediaType(contentType)
// mediaType == "text/html"

Import

To import package ctype use import code like the following:

import "codeberg.org/reiver/go-ctype"

Installation

To install package ctype do the following:

GOPROXY=direct go get codeberg.org/reiver/go-ctype

Author

Package ctype was written by Charles Iliya Krempeaux