httpHelpers

package
v0.0.0-...-8a04328 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: GPL-3.0, GPL-3.0-only Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTML      = "text/html; charset=utf-8"
	JSON      = "application/json; charset=utf-8"
	CSS       = "text/css; charset=utf-8"
	JS        = "application/javascript; charset=utf-8"
	SOURCEMAP = JSON
	MP3       = "audio/mpeg"
)

Content types for different file types

View Source
const (
	CONTENT_TYPE        = "Content-Type"
	EXPIRES             = "Expires"
	CACHE_CONTROL       = "Cache-Control"
	CONTENT_DISPOSITION = "Content-Disposition"
	CONTENT_LENGTH      = "Content-Length"
	NO_CACHE            = "No-Cache"
	CONTENT_RANGE       = "Content-Range"
)

These constants store the different headers the suluvir application is setting explicitly

View Source
const (
	GET    = "GET"
	POST   = "POST"
	DELETE = "DELETE"
	HEAD   = "HEAD"
	PUT    = "PUT"
)

Available HTTP methods

Variables

This section is empty.

Functions

func GetContentType

func GetContentType(fileType string) (string, error)

GetContentType returns the appropriate content type for a given file type. It returns an error, if no such content type could be found

func ServeJsonWithoutCache

func ServeJsonWithoutCache(w http.ResponseWriter, v interface{}) error

ServeJsonWithoutCache takes a response writer and some data as parameters and sets the correct headers, so that clients do (hopefully) not store this response in their caches. It also writes the given data to the response

Types

This section is empty.

Jump to

Keyboard shortcuts

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