initial import

This commit is contained in:
SourceFellows
2020-08-21 06:26:40 +02:00
commit e223458dd4
423 changed files with 9871 additions and 0 deletions

View File

@ -0,0 +1,4 @@
POST http://localhost:8080/ HTTP/1.1
Content-Type: application/x-www-form-urlencoded
name=Peter

View File

@ -0,0 +1,3 @@
module golang.source-fellows.com/samples/formrequest
go 1.13

View File

@ -0,0 +1,18 @@
package main
import "net/http"
func handleForm(rw http.ResponseWriter, rq *http.Request) {
err := rq.ParseForm()
if err != nil {
rw.WriteHeader(http.StatusNotAcceptable)
return
}
name := rq.Form.Get("name")
rw.Write([]byte("Hello " + name))
}
func main() {
http.HandleFunc("/", handleForm)
http.ListenAndServe(":8080", nil)
}