Add Client.GetInput field

This commit is contained in:
Adnan Maolood
2020-10-27 23:35:22 -04:00
parent d1dcf070ff
commit 4c5167f590
6 changed files with 61 additions and 60 deletions

View File

@@ -273,7 +273,8 @@ type Responder interface {
// If no input is provided, it responds with StatusInput.
func Input(w *ResponseWriter, r *Request, prompt string) (string, bool) {
if r.URL.ForceQuery || r.URL.RawQuery != "" {
return r.URL.RawQuery, true
query, err := url.QueryUnescape(r.URL.RawQuery)
return query, err == nil
}
w.WriteHeader(StatusInput, prompt)
return "", false
@@ -283,7 +284,8 @@ func Input(w *ResponseWriter, r *Request, prompt string) (string, bool) {
// If no input is provided, it responds with StatusSensitiveInput.
func SensitiveInput(w *ResponseWriter, r *Request, prompt string) (string, bool) {
if r.URL.ForceQuery || r.URL.RawQuery != "" {
return r.URL.RawQuery, true
query, err := url.QueryUnescape(r.URL.RawQuery)
return query, err == nil
}
w.WriteHeader(StatusSensitiveInput, prompt)
return "", false