You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
518 B

package nwweb
import (
"net/http"
"net/url"
)
type form struct {
convertable
postForm url.Values
httpRequest *http.Request
}
func newForm(httpRequest *http.Request) form {
if httpRequest.Form == nil {
httpRequest.ParseForm()
}
f := form{httpRequest: httpRequest}
f.stringVal = func(key string) string {
return f.httpRequest.Form.Get(key)
}
return f
}
func (f *form) Set(key string, value any) {
if f.postForm == nil {
f.postForm = url.Values{}
}
f.postForm.Set(key, anyToString(value))
}