Skip to content

Instantly share code, notes, and snippets.

@nickpresta
Created August 20, 2013 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickpresta/6276195 to your computer and use it in GitHub Desktop.
Save nickpresta/6276195 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Method: %s\n", r.Method)
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
$ telnet 127.0.0.1 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GEM / HTTP/1.1
Host: example.org
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 12
Date: Tue, 20 Aug 2013 01:37:33 GMT
Method: GEM
LINK / HTTP/1.1
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 13
Date: Tue, 20 Aug 2013 01:37:48 GMT
Method: LINK
PUN / HTTP/1.1
Host: example.org
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 12
Date: Tue, 20 Aug 2013 01:37:57 GMT
Method: PUN
POSH / HTTP/1.1
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 13
Date: Tue, 20 Aug 2013 01:38:04 GMT
Method: POSH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment