all repos — honk @ 7f6e541f20e24eaceeb981d328b9b3e04eb05fb3

my fork of honk

u
Anirudh Oppiliappan x@icyphox.sh
Sun, 24 Sep 2023 11:55:12 +0300
commit

7f6e541f20e24eaceeb981d328b9b3e04eb05fb3

parent

50956be52df32a5362fd20621515f496f039ae16

1 files changed, 7 insertions(+), 3 deletions(-)

jump to
M masto.gomasto.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 {