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

Delta Between Two Patch Sets: src/pkg/net/http/example_test.go

Issue 6032052: code review 6032052: net/http: add example for StripPrefix, and mention that... (Closed)
Left Patch Set: diff -r 6c1797405851 https://code.google.com/p/go/ Created 12 years, 11 months ago
Right Patch Set: diff -r b93d51d8ac36 https://code.google.com/p/go/ Created 12 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package http_test 5 package http_test
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "io/ioutil" 9 "io/ioutil"
10 "log" 10 "log"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 log.Fatal(err) 43 log.Fatal(err)
44 } 44 }
45 robots, err := ioutil.ReadAll(res.Body) 45 robots, err := ioutil.ReadAll(res.Body)
46 if err != nil { 46 if err != nil {
47 log.Fatal(err) 47 log.Fatal(err)
48 } 48 }
49 res.Body.Close() 49 res.Body.Close()
50 fmt.Printf("%s", robots) 50 fmt.Printf("%s", robots)
51 } 51 }
52 52
53 func ExampleStripPrefix() { 53 func ExampleFileServer() {
54 // we use StripPrefix so that /tmpfiles/somefile will access /tmp/somefi le 54 // we use StripPrefix so that /tmpfiles/somefile will access /tmp/somefi le
55 http.Handle("/tmpfiles/", http.StripPrefix("/tmpfiles/", http.FileServer (http.Dir("/tmp")))) 55 http.Handle("/tmpfiles/", http.StripPrefix("/tmpfiles/", http.FileServer (http.Dir("/tmp"))))
56 } 56 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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