I'd like to log 301s vs 302s but can't see a way to read the response status code in Client.Do, Get, doFollowingRedirects, CheckRedirect. Will I have to implement redirection myself to achieve this?
相关问题
- Angular RxJS mergeMap types
- Stop .htaccess redirect with query string
- Google Apps Script: testing doPost() with cURL
- How to instantiate Http service in main.ts manuall
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
相关文章
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- Can I run a single test in a suite?
- How to get jQuery.ajax response status?
- send redirect and setting cookie, using laravel 5
- How to check if a request was cancelled
- Is it possible to implement an interface with unex
- Is a unicode user agent legal inside an HTTP heade
- How to access value of first index of array in Go
The
http.Client
type allows you to specify a custom transport, which should allow you to do what you're after. Something like the following should do:(you could simplify this a little if you only support chaining to the default transport).
You can then create a client using this transport, and any redirects should be logged:
Here is a full example you can experiment with: http://play.golang.org/p/8uf8Cn31HC