Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(979)

Issue 4535056: code review 4535056: http: remove finalURL from Client.Get; move to Response (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years ago by bradfitz
Modified:
13 years ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

http: remove finalURL from Client.Get; move to Response This CL: -- removes Response.RequestMethod string -- adds Response.Request *Request -- removes the finalURL result parameter from client.Get() -- adds a gofix rule for callers of http.Get which assign the final url to the blank identifier; warning otherwise Caller who did: res, finalURL, err := http.Get(...) now need to do: res, err := http.Get(...) if err != nil { ... } finalURL := res.Request.URL.String()

Patch Set 1 #

Patch Set 2 : diff -r c85198087f01 https://go.googlecode.com/hg #

Patch Set 3 : diff -r c85198087f01 https://go.googlecode.com/hg #

Patch Set 4 : diff -r c85198087f01 https://go.googlecode.com/hg #

Total comments: 6

Patch Set 5 : diff -r f92afedc0ac0 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+202 lines, -99 lines) Patch
M doc/codelab/wiki/get.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M misc/dashboard/builder/http.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/godoc/main.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/gofix/Makefile View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A src/cmd/gofix/httpfinalurl.go View 1 2 3 4 1 chunk +56 lines, -0 lines 0 comments Download
A src/cmd/gofix/httpfinalurl_test.go View 1 2 3 4 1 chunk +37 lines, -0 lines 0 comments Download
M src/pkg/http/client.go View 1 3 chunks +2 lines, -9 lines 0 comments Download
M src/pkg/http/client_test.go View 1 4 chunks +6 lines, -4 lines 0 comments Download
M src/pkg/http/fs_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/http/persist.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/http/request_test.go View 1 1 chunk +2 lines, -1 line 0 comments Download
M src/pkg/http/response.go View 1 2 3 4 3 chunks +17 lines, -12 lines 0 comments Download
M src/pkg/http/response_test.go View 1 13 chunks +31 lines, -27 lines 0 comments Download
M src/pkg/http/responsewrite_test.go View 1 4 chunks +7 lines, -7 lines 0 comments Download
M src/pkg/http/reverseproxy_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/http/serve_test.go View 1 11 chunks +11 lines, -11 lines 0 comments Download
M src/pkg/http/transfer.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/http/transport.go View 1 2 chunks +11 lines, -7 lines 0 comments Download
M src/pkg/http/transport_test.go View 1 7 chunks +7 lines, -7 lines 0 comments Download
M src/pkg/rpc/client.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/websocket/client.go View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/websocket/websocket_test.go View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 7
bradfitz
Hello rsc@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg
13 years ago (2011-05-12 21:15:13 UTC) #1
rsc
Please add a gofix module that does a, _, c = http.Get(...) -> a, c ...
13 years ago (2011-05-12 21:16:47 UTC) #2
bradfitz
Hello rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years ago (2011-05-12 22:18:59 UTC) #3
bradfitz
Now with a gofixer. On Thu, May 12, 2011 at 3:18 PM, <bradfitz@golang.org> wrote: > ...
13 years ago (2011-05-12 23:06:32 UTC) #4
rsc
LGTM http://codereview.appspot.com/4535056/diff/7001/src/cmd/gofix/httpfinalurl.go File src/cmd/gofix/httpfinalurl.go (right): http://codereview.appspot.com/4535056/diff/7001/src/cmd/gofix/httpfinalurl.go#newcode40 src/cmd/gofix/httpfinalurl.go:40: assign, ok := n.(*ast.AssignStmt) s/assign/as/ if you want ...
13 years ago (2011-05-13 02:45:13 UTC) #5
bradfitz
All done. On Thu, May 12, 2011 at 7:45 PM, <rsc@golang.org> wrote: > LGTM > ...
13 years ago (2011-05-13 14:14:17 UTC) #6
bradfitz
13 years ago (2011-05-13 14:31:35 UTC) #7
*** Submitted as http://code.google.com/p/go/source/detail?r=36ae0aad165b ***

http: remove finalURL from Client.Get; move to Response

This CL:

-- removes Response.RequestMethod string
-- adds Response.Request *Request
-- removes the finalURL result parameter from client.Get()
-- adds a gofix rule for callers of http.Get which assign
   the final url to the blank identifier; warning otherwise

Caller who did:

res, finalURL, err := http.Get(...)

now need to do:

res, err := http.Get(...)
if err != nil {
   ...
}
finalURL := res.Request.URL.String()

R=rsc
CC=golang-dev
http://codereview.appspot.com/4535056
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b