Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetContentType ¶ added in v0.0.3
func SetContentType(w http.ResponseWriter, file io.Reader, fileName string)
SetContentType Setst the content type to the responsewriter by the filename or the content
func SetContentTypeWithName ¶ added in v0.0.3
func SetContentTypeWithName(w http.ResponseWriter, fileName string) bool
Types ¶
type HTTPFileContainer ¶ added in v0.0.3
type HTTPFileContainer struct {
// contains filtered or unexported fields
}
func NewHTTPFileContainer ¶ added in v0.0.5
func NewHTTPFileContainer(fileStorage storageabstraction.IFileStorage, rootDir string) *HTTPFileContainer
func (*HTTPFileContainer) ServeHTTP ¶ added in v0.0.5
func (container *HTTPFileContainer) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request)
type HTTPServer ¶ added in v0.0.3
type HTTPServer struct {
// contains filtered or unexported fields
}
func NewHTTPServer ¶ added in v0.0.3
func NewHTTPServer(logger log.Logger) *HTTPServer
func (*HTTPServer) SetRoutes ¶ added in v0.0.3
func (server *HTTPServer) SetRoutes(routes http.Handler)
func (*HTTPServer) StartHTTPSServer ¶ added in v0.0.3
func (server *HTTPServer) StartHTTPSServer()
func (*HTTPServer) StartHTTPServer ¶ added in v0.0.3
func (server *HTTPServer) StartHTTPServer()
type TResponse ¶
type TResponse struct {
StatusCode int `json:"statusCode"`
Status string `json:"status"`
Message string `json:"message"`
Content interface{} `json:"content"`
}
TResponse is the default response to the client
func GetDefaultResponse ¶
GetDefaultResponse creats a successful response with content
func GetErrorResponse ¶
GetErrorResponse creates a error response with message and errorcode
func HTTPRoutingErrorHandler ¶ added in v0.0.3
func (*TResponse) Encode ¶
func (response *TResponse) Encode(w http.ResponseWriter) error
Encode writes the response to the writer and sets the content type with status code 200
func (*TResponse) EncodeStatus ¶
func (response *TResponse) EncodeStatus(w http.ResponseWriter, statusCode int) error
EncodeStatus writes the response to the responseWriter and sets also the status code
Click to show internal directories.
Click to hide internal directories.