initial commits

master
Charles Iliya Krempeaux 2023-09-26 14:22:00 +09:00
parent c5ee57c881
commit 3a2cac064f
1 changed files with 20 additions and 0 deletions

20
ok.go 100644
View File

@ -0,0 +1,20 @@
package mstdn
import (
"encoding/json"
"net/http"
)
func OK(resp http.ResponseWriter, value interface{}) {
if nil == resp {
return
}
resp.WriteHeader(http.StatusOK)
resp.Header().Add("Content-Type", "application/json; charset=utf-8")
err := json.NewEncoder(resp).Encode(value)
if nil != err {
// Nothing here.
}
}