Skip to content

Commit e585480

Browse files
committed
Use a string instead of a constant
Some of my training classes have been stuck on Go 1.3 which doesn't include the http.MethodGet constant. It's such a minor change that I don't mind changing it back.
1 parent 30f793d commit e585480

File tree

1 file changed

+2
-2
lines changed
  • topics/go/exercises/contributors/githubmock

1 file changed

+2
-2
lines changed

topics/go/exercises/contributors/githubmock/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ func handle(w http.ResponseWriter, r *http.Request) {
2222
}
2323

2424
// Only allow GET requests.
25-
if r.Method != http.MethodGet {
26-
http.Error(w, "request method must be "+http.MethodGet, http.StatusMethodNotAllowed)
25+
if r.Method != "GET" {
26+
http.Error(w, "request method must be GET", http.StatusMethodNotAllowed)
2727
return
2828
}
2929

0 commit comments

Comments
 (0)