1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:14:44 -07:00

godoc: set proper content-type header on share request

When sending the request to /share, it defaulted to
application/x-www-form-urlencoded. This caused the body to be
empty since it was sending a form with the actual code as a
key in the r.Form map.

Set the content type explicitly to text/plain.

Fixes golang/go#21691

Change-Id: I0d5981d9c9aa901010af65b0d0a7670870b77f2b
Reviewed-on: https://go-review.googlesource.com/86317
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This commit is contained in:
Andrew Bonventre 2018-01-04 22:24:33 -05:00
parent 08da88d271
commit b790d0ba03
2 changed files with 3 additions and 1 deletions

View File

@ -403,6 +403,7 @@ function PlaygroundOutput(el) {
processData: false,
data: sharingData,
type: "POST",
contentType: "text/plain; charset=utf-8",
complete: function(xhr) {
sharing = false;
if (xhr.status != 200) {

View File

@ -1,4 +1,4 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
@ -2599,6 +2599,7 @@ function PlaygroundOutput(el) {
processData: false,
data: sharingData,
type: "POST",
contentType: "text/plain; charset=utf-8",
complete: function(xhr) {
sharing = false;
if (xhr.status != 200) {