README.md: update example commands and remove redundant text

1. Pass the payload to `/compile` using `curl --upload` instead of
`curl --data`.

With the `--data` flag, curl encodes the data in a way that triggers
the call to `(*http.Request).FormValue` (sandbox.go:56) to consume the
request body. When we then attempt to decode the body as JSON
(sandbox.go:58), we then fail the request with `io.EOF`.

If we use the `--upload` flag instead, curl does not set the content
type to the problematic `application/x-www-form-urlencoded` value, and
the call to `FormValue` does not consume the body.

2. Add a name to the `docker run` command line.

(That makes it easier to kill the container when we're done with it.)

3. Remove a redundant copy of the “To submit changes…” sentence.

Change-Id: I314d904f626029306fecbfd25b166927dfa01029
Reviewed-on: https://go-review.googlesource.com/106215
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Bryan C. Mills 2018-04-11 01:01:01 -04:00
Родитель f980e90afd
Коммит 66c23b73d8
1 изменённых файлов: 5 добавлений и 6 удалений

Просмотреть файл

@ -3,8 +3,6 @@
This subrepository holds the source for the Go playground:
https://play.golang.org/
To submit changes to this repository, see http://golang.org/doc/contribute.html.
## Building
```
@ -15,9 +13,9 @@ docker build -t playground .
## Running
```
docker run --rm -d -p 8080:8080 playground
# run go some code
cat /path/to/code.go | go run client.go | curl --data @- localhost:8080/compile
docker run --name=play --rm -d -p 8080:8080 playground
# run some Go code
cat /path/to/code.go | go run client.go | curl -s --upload-file - localhost:8080/compile
```
# Deployment
@ -28,4 +26,5 @@ gcloud --project=golang-org --account=person@example.com app deploy app.yaml
# Contributing
To submit changes to this repository, see http://golang.org/doc/contribute.html.
To submit changes to this repository, see
https://golang.org/doc/contribute.html.