go-mstdn/ok.go

21 lines
331 B
Go
Raw Permalink Normal View History

2023-09-26 05:22:00 +00:00
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.
}
}