Skip to content

Commit

Permalink
playground: set content-type header on non-appengine builds
Browse files Browse the repository at this point in the history
Currently, when a POST request is made using code with build tag
+build !appengine it doesn't set the content-type header passed
to the function. This was breaking the case where a url-encoded
body (a code snippet's body and protocol version) was being POSTed
to golang.org/compile since it never set the content-type of the
request and the corresponding form values parsed out were empty as
a result.

Update golang/go#28080

Change-Id: I677ca01b2f5aecedbd13d1faa7a838ddc0199244
Reviewed-on: https://go-review.googlesource.com/c/140838
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
  • Loading branch information
andybons committed Oct 10, 2018
1 parent afb0372 commit 9ae4309
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions playground/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func post(ctx context.Context, url, contentType string, body io.Reader) (*http.R
if err != nil {
return nil, fmt.Errorf("http.NewRequest: %v", err)
}
req.Header.Set("Content-Type", contentType)
return http.DefaultClient.Do(req.WithContext(ctx))
}

Expand Down

0 comments on commit 9ae4309

Please sign in to comment.