From ffe489915325959c8cff1f2e6c75db127951d815 Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Mon, 15 Dec 2014 16:09:51 -0800 Subject: [PATCH] Add POST support to XHR as well as .status and statusText support Also fixed all the XHR tests to actually run and work I learned from elliot that the it function has to take a "done" argument to be treated asynchronously. My utf8 conversion is a hack, but we deleted window.TextEncoder (it was a module) when we forked. We could resurrect TextEncoder (and probably should) but I've left that for a separate change. I also augmented sky_server to have a special /echo_post handler so we can test POST requests. R=esprehn@chromium.org BUG= Review URL: https://codereview.chromium.org/810523002 --- engine/src/flutter/tools/skygo/sky_server.go | 6 ++++++ engine/src/flutter/tools/skygo/sky_server.sha1 | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/tools/skygo/sky_server.go b/engine/src/flutter/tools/skygo/sky_server.go index c69fdd5204..e851487c09 100644 --- a/engine/src/flutter/tools/skygo/sky_server.go +++ b/engine/src/flutter/tools/skygo/sky_server.go @@ -6,6 +6,7 @@ package main import ( "flag" + "io/ioutil" "net/http" "path" "strings" @@ -38,6 +39,11 @@ func main() { genRoot := path.Join(root, "out", *configuration, "gen") http.Handle("/", skyHandler(root)) + http.HandleFunc("/echo_post", func(w http.ResponseWriter, r *http.Request) { + defer r.Body.Close() + body, _ := ioutil.ReadAll(r.Body) + w.Write(body) + }) http.Handle("/mojo/public/", http.StripPrefix("/mojo/public/", skyHandler(path.Join(genRoot, "mojo", "public")))) http.Handle("/mojo/services/", http.StripPrefix("/mojo/services/", skyHandler(path.Join(genRoot, "mojo", "services")))) http.Handle("/sky/services/", http.StripPrefix("/sky/services/", skyHandler(path.Join(genRoot, "sky", "services")))) diff --git a/engine/src/flutter/tools/skygo/sky_server.sha1 b/engine/src/flutter/tools/skygo/sky_server.sha1 index 38a08c775a..8b7306e10f 100644 --- a/engine/src/flutter/tools/skygo/sky_server.sha1 +++ b/engine/src/flutter/tools/skygo/sky_server.sha1 @@ -1 +1 @@ -7b6d0d60949ad71a35a88430b2eb7d70fe7334b6 \ No newline at end of file +f6b808791e8ab0290cb18bc8b444159074c395ae \ No newline at end of file