accept moon or json

master
Jordan Orelli 9 years ago
parent ea66a11355
commit 9aaeccccee

@ -51,17 +51,17 @@ func (r *repl) run() {
continue
}
doc, err := moon.Read(&body_in)
if err != nil {
r.errorf("moon parse error: %v", err)
continue
}
body_json, err := doc.MarshalJSON()
var body_json []byte
doc, err := moon.ReadBytes(body_in.Bytes())
if err == nil {
body_json, err = doc.MarshalJSON()
if err != nil {
r.errorf("moon to json encode error: %v", err)
continue
}
} else {
body_json = body_in.Bytes()
}
// compose http request
fqurl := fmt.Sprintf("http://%s:%d/%s", r.host, r.port, url_s)

Loading…
Cancel
Save