Add application/x-www-form-urlencoded to micropub endpoint
This commit is contained in:
parent
9a6ecac4d8
commit
6426b31c0b
|
@ -7,6 +7,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/garyburd/redigo/redis"
|
"github.com/garyburd/redigo/redis"
|
||||||
"github.com/pstuifzand/ekster/pkg/microsub"
|
"github.com/pstuifzand/ekster/pkg/microsub"
|
||||||
|
@ -74,6 +75,12 @@ func (h *micropubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
item = mapToItem(simplifyMicroformat(&mfItem))
|
item = mapToItem(simplifyMicroformat(&mfItem))
|
||||||
ok = true
|
ok = true
|
||||||
|
} else if r.Header.Get("Content-Type") == "application/x-www-form-urlencoded" {
|
||||||
|
content := r.FormValue("content")
|
||||||
|
name := r.FormValue("name")
|
||||||
|
item.Name = name
|
||||||
|
item.Content = µsub.Content{Text: content}
|
||||||
|
item.Published = time.Now().Format(time.RFC3339)
|
||||||
} else {
|
} else {
|
||||||
http.Error(w, "Unsupported Content-Type", 400)
|
http.Error(w, "Unsupported Content-Type", 400)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user