import other kontor repos into directories
This commit is contained in:
committed by
Thomas Peetz
parent
28746adfbb
commit
b424e95e05
@@ -0,0 +1,20 @@
|
||||
package response
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Response is a generic HTTP Response Struct
|
||||
type Response struct {
|
||||
Data string `json:"data"`
|
||||
}
|
||||
|
||||
// Send a HTTP Response
|
||||
func Send(responseWriter http.ResponseWriter, code int, payload interface{}, contentType string) {
|
||||
response, _ := json.Marshal(payload)
|
||||
|
||||
responseWriter.Header().Set("Content-Type", contentType)
|
||||
responseWriter.WriteHeader(code)
|
||||
responseWriter.Write(response)
|
||||
}
|
||||
Reference in New Issue
Block a user