1
0
mirror of https://github.com/golang/go synced 2024-10-02 06:18:32 -06:00
go/src
Dmitri Shuralyov 73e38303f3 net/http: write status code in Redirect when Content-Type header set
This is a followup to CL 110296. That change added a new behavior
to Redirect, where the short HTML body is not written if the
Content-Type header is already set. It was implemented by doing
an early return. That unintentionally prevented the correct status
code from being written, so it would always default to 200.
Existing tests didn't catch this because they don't check status code.

This change fixes that issue by removing the early return and
moving the code to write a short HTML body behind an if statement.
It adds written status code checks to Redirect tests.

It also tries to improve the documentation wording and code style
in TestRedirect_contentTypeAndBody.

Updates #25166.

Change-Id: Idce004baa88e278d098661c03c9523426c5eb898
Reviewed-on: https://go-review.googlesource.com/111517
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-04 18:01:10 +00:00
..
archive archive/zip: avoid data descriptor when writing directories 2018-05-02 23:34:50 +00:00
bufio bufio: document ReadFrom/WriteTo calls to underlying methods 2018-03-28 22:21:52 +00:00
builtin
bytes bytes, strings: improve EqualFold fast version for ASCII 2018-05-01 18:52:19 +00:00
cmd cmd/compile: add wasm architecture 2018-05-04 17:56:12 +00:00
compress compress/gzip: skip builder-only test on iOS 2018-05-04 14:46:19 +00:00
container container/heap: fix comments style 2018-04-11 20:11:09 +00:00
context context: avoid defer in the cancelCtx.Err method 2018-04-15 21:35:53 +00:00
crypto crypto/rand, crypto/x509: add js/wasm architecture 2018-05-03 18:00:24 +00:00
database/sql database/sql: trivial documentation fixes 2018-05-01 14:43:13 +00:00
debug all: skip unsupported tests for js/wasm 2018-04-30 19:39:18 +00:00
encoding all: skip unsupported tests for js/wasm 2018-04-30 19:39:18 +00:00
errors
expvar all: use strings.Builder instead of bytes.Buffer where appropriate 2018-03-26 23:05:53 +00:00
flag flag: correct zero values when printing defaults 2018-04-01 20:17:22 +00:00
fmt fmt: make %v doc for compound objects consistent 2018-04-17 23:47:44 +00:00
go cmd/go, go/build: add support for gccgo tooldir 2018-05-04 00:46:12 +00:00
hash
html text/template: copy Decl field when copying PipeNode 2018-04-10 14:26:58 +00:00
image all: fix non-standard "DO NOT EDIT" comments for generated files 2018-03-10 17:50:11 +00:00
index/suffixarray
internal internal/cpu: remove platform specific prefix from cpu hwcap variables 2018-05-01 15:50:19 +00:00
io io/ioutil: change TempFile prefix to a pattern 2018-04-12 20:00:25 +00:00
log all: skip unsupported tests for js/wasm 2018-04-30 19:39:18 +00:00
math math/bits: move tests into their own package 2018-05-01 15:33:01 +00:00
mime mime: add wasm architecture 2018-04-13 20:20:12 +00:00
net net/http: write status code in Redirect when Content-Type header set 2018-05-04 18:01:10 +00:00
os os: remove superfluous comments 2018-05-02 14:41:57 +00:00
path path/filepath: fix Win32 tests missing 'chcp' 2018-04-26 18:25:15 +00:00
plugin
reflect reflect: define MyBuffer more locally in TestImplicitMapConversion 2018-04-18 12:47:39 +00:00
regexp regexp: use sync.Pool to cache regexp.machine objects 2018-04-03 16:03:19 +00:00
runtime runtime: fast clock_gettime on FreeBSD, always call getHPETTimecounter on systemstack 2018-05-04 17:34:20 +00:00
sort sort: fix typo in comment 2018-04-22 22:32:11 +00:00
strconv strconv: simplify and optimize Itoa(small) 2018-05-03 18:07:02 +00:00
strings strings: fix encoding of \u0080 in map 2018-05-04 05:37:45 +00:00
sync sync/atomic: redirect many functions to runtime/internal/atomic 2018-05-03 21:35:01 +00:00
syscall syscall/js: add package 2018-05-03 18:00:07 +00:00
testing testing: fix racey access to t.failed 2018-05-02 17:51:26 +00:00
text all: skip unsupported tests for js/wasm 2018-04-30 19:39:18 +00:00
time cmd/vet: better align print warnings with fmt 2018-05-04 02:57:37 +00:00
unicode
unsafe
vendor/golang_org/x vendor: update golang.org/x/net/internal/nettest from upstream 2018-05-04 17:34:07 +00:00
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash src/*.bash: remove some trailing whitespace 2018-05-04 14:47:49 +00:00
make.bat
Make.dist
make.rc
naclmake.bash
nacltest.bash
race.bash src/*.bash: remove some trailing whitespace 2018-05-04 14:47:49 +00:00
race.bat
run.bash src/run.bash: remove some trailing whitespace 2018-04-01 16:12:47 +00:00
run.bat
run.rc