Simplify config request

master
Jan-Lukas Else 2020-03-26 12:03:48 +01:00
parent 0faf4c8e39
commit 442395a83c
1 changed files with 1 additions and 7 deletions

View File

@ -17,16 +17,10 @@ func HandleMicroPub(w http.ResponseWriter, r *http.Request) {
if q := r.URL.Query().Get("q"); q == "config" || q == "syndicate-to" { if q := r.URL.Query().Get("q"); q == "config" || q == "syndicate-to" {
w.Header().Add("Content-type", "application/json") w.Header().Add("Content-type", "application/json")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
jsonBytes, err := json.Marshal(&MicropubConfig{ _ = json.NewEncoder(w).Encode(&MicropubConfig{
SyndicateTo: SyndicationTargets, SyndicateTo: SyndicationTargets,
MediaEndpoint: MediaEndpointUrl, MediaEndpoint: MediaEndpointUrl,
}) })
if err != nil {
w.WriteHeader(http.StatusBadRequest)
_, _ = w.Write([]byte(err.Error()))
return
}
_, _ = w.Write(jsonBytes)
return return
} else { } else {
w.Header().Add("Content-type", "application/json") w.Header().Add("Content-type", "application/json")