u
Anirudh Oppiliappan x@icyphox.sh
Sun, 24 Sep 2023 11:55:12 +0300
1 files changed,
7 insertions(+),
3 deletions(-)
jump to
M
masto.go
→
masto.go
@@ -19,6 +19,12 @@ elog.Printf("%s: bad junk: %s", path, j.ToString())
http.Error(rw, fmt.Sprintf("%s: bad junk", path), http.StatusBadRequest) } +func goodjunk(rw http.ResponseWriter, j junk.Junk) { + rw.WriteHeader(http.StatusOK) + rw.Header().Set("Content-Type", "application/json; charset=utf-8") + rw.Write(j.ToBytes()) +} + // https://docs.joinmastodon.org/methods/apps/#create func apiapps(rw http.ResponseWriter, r *http.Request) { if err := r.ParseForm(); err != nil {@@ -51,9 +57,7 @@ j["client_secret"] = clientSecret
j["vapid_key"] = vapidKey fmt.Println(j.ToString()) - - rw.WriteHeader(http.StatusOK) - rw.Write(j.ToBytes()) + goodjunk(rw, j) } func tokengen() string {