Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: sky/tools/skygo/sky_server.go

Issue 810523002: Add POST support to XHR as well as .status and statusText support (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Now with post testing Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/tests/framework/xmlhttprequest/xhr-relative.sky ('k') | sky/tools/skygo/sky_server.sha1 » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package main 5 package main
6 6
7 import ( 7 import (
8 "flag" 8 "flag"
9 "io/ioutil"
9 "net/http" 10 "net/http"
10 "path" 11 "path"
11 "strings" 12 "strings"
12 ) 13 )
13 14
14 type skyHandlerRoot struct { 15 type skyHandlerRoot struct {
15 root string 16 root string
16 } 17 }
17 18
18 func skyHandler(root string) http.Handler { 19 func skyHandler(root string) http.Handler {
(...skipping 12 matching lines...) Expand all
31 var configuration = flag.String("t", "Release", "The target configuration (i .e. Release or Debug)") 32 var configuration = flag.String("t", "Release", "The target configuration (i .e. Release or Debug)")
32 flag.Parse() 33 flag.Parse()
33 34
34 args := flag.Args() 35 args := flag.Args()
35 root := args[0] 36 root := args[0]
36 port := args[1] 37 port := args[1]
37 38
38 genRoot := path.Join(root, "out", *configuration, "gen") 39 genRoot := path.Join(root, "out", *configuration, "gen")
39 40
40 http.Handle("/", skyHandler(root)) 41 http.Handle("/", skyHandler(root))
42 http.HandleFunc("/echo_post", func(w http.ResponseWriter, r *http.Request) {
43 defer r.Body.Close()
44 body, _ := ioutil.ReadAll(r.Body)
45 w.Write(body)
46 })
41 http.Handle("/mojo/public/", http.StripPrefix("/mojo/public/", skyHandler(pa th.Join(genRoot, "mojo", "public")))) 47 http.Handle("/mojo/public/", http.StripPrefix("/mojo/public/", skyHandler(pa th.Join(genRoot, "mojo", "public"))))
42 http.Handle("/mojo/services/", http.StripPrefix("/mojo/services/", skyHandle r(path.Join(genRoot, "mojo", "services")))) 48 http.Handle("/mojo/services/", http.StripPrefix("/mojo/services/", skyHandle r(path.Join(genRoot, "mojo", "services"))))
43 http.Handle("/sky/services/", http.StripPrefix("/sky/services/", skyHandler( path.Join(genRoot, "sky", "services")))) 49 http.Handle("/sky/services/", http.StripPrefix("/sky/services/", skyHandler( path.Join(genRoot, "sky", "services"))))
44 50
45 http.ListenAndServe(":" + port, nil) 51 http.ListenAndServe(":" + port, nil)
46 } 52 }
OLDNEW
« no previous file with comments | « sky/tests/framework/xmlhttprequest/xhr-relative.sky ('k') | sky/tools/skygo/sky_server.sha1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698