accept moon or json

master
Jordan Orelli 9 years ago
parent ea66a11355
commit 9aaeccccee

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

Loading…
Cancel
Save