{"modulePath":"github.com/mutablelogic/go-server","version":"v1.4.11","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package httpresponse\n\n## Constants\n\n```go\nconst (\n\tContentTypeKey   = \"Content-Type\"\n\tContentLengthKey = \"Content-Length\"\n\tContentTypeJSON  = \"application/json\"\n\tContentTypeText  = \"text/plain\"\n)\n```\n\n## Functions\n\n```go\nfunc Empty(w http.ResponseWriter, code int)\n```\nEmpty is a utility function to serve an empty response\n\n```go\nfunc Error(w http.ResponseWriter, code int, reason ...string) error\n```\nError is a utility function to serve a JSON error notice\n\n```go\nfunc JSON(w http.ResponseWriter, v interface{}, code int, indent uint) error\n```\nJSON is a utility function to serve an arbitary object as JSON\n\n```go\nfunc Text(w http.ResponseWriter, v string, code int)\n```\nText is a utility function to serve plaintext\n\n## Types\n\n```go\ntype ErrorResponse struct {\n\tCode   int    `json:\"code\"`\n\tReason string `json:\"reason,omitempty\"`\n}\n```\nErrorResponse is a generic error response which is served as JSON using the ServeError method\n\n","path":"github.com/mutablelogic/go-server/pkg/httpserver/httpresponse","name":"httpresponse","synopsis":"","isRedistributable":true}
