Skip to content

List of Common ContentTypes that aren't included in go std library

License

Notifications You must be signed in to change notification settings

hunter32292/go-mtype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mtype = Media Type

List of const content types, because I keep forgetting them. Just use autocomplete with the package and you can stop dealing with missed chars in your content types or forgetting what content types you can use.

Notes

This is a subset of all content types, only some of the more common ones.

Complete list here: https://www.iana.org/assignments/media-types/media-types.xhtml

To Use:

import module:

go get -u github.com/hunter32292/go-mtype

Include in application like so:

package main

import (
	"io"
	"log"
	"net/http"

	"github.com/hunter32292/go-mtype"
)

func main() {
	http.HandleFunc("/health", Health)
	log.Fatal(http.ListenAndServe("localhost:8080", nil))
}

func Health(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", mtype.ApplicationJson)
	io.WriteString(w, `{"alive":"true"}`)
}

Find From the Const List: image

About

List of Common ContentTypes that aren't included in go std library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages