Go web server does not process /delete/ pattern correctly -


i played google go official example writing web applications tried add functionality delete pages , has not worked. reason if pass "/delete/" parameter http.handlefunc() function 404 page not found. other "foobar" string works expected.

simplified code:

package main  import (     "fmt"     "net/http" )  func handler(w http.responsewriter, r *http.request) {     fmt.fprintf(w, "%s", r.url.path) }  func main() {     http.handlefunc("/hello/", handler)     //http.handlefunc("/delete/", handler)     http.listenandserve(":8080", nil) } 

steps reproduce:

  1. compile , call http://localhost:8080/hello/world browser
  2. output /hello/world
  3. now comment http.handlefunc("/hello/", handler) , uncomment http.handlefunc("/delete/", handler)
  4. compile , call http://localhost:8080/delete/world browser
  5. result 404 page not found, expected /delete/world

question: there special meaning "/delete/" pattern? there technical reason or bug?

this works fine here, , cannot possibly work in 1 situation , not other. you're changing string "hello" string "delete" between 2 lines.

i suggest trying again more carefully. must detail elsewhere.


the real reason not checking error result of listenandserve. old copy running in background, , lack of error handling made go unperceived. browser getting results old server.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -