Simplify config request
parent
0faf4c8e39
commit
442395a83c
|
@ -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")
|
||||||
|
|
Loading…
Reference in New Issue