FormFieldWithConf same as `FormField` but it accepts the application's configuration to parse the form based on the app core configuration.
(fieldName string, conf context.ConfigurationReadOnly)
| 123 | // FormFieldWithConf same as `FormField` but it accepts the application's |
| 124 | // configuration to parse the form based on the app core configuration. |
| 125 | func FormFieldWithConf(fieldName string, conf context.ConfigurationReadOnly) Option { |
| 126 | var ( |
| 127 | postMaxMemory int64 = 32 << 20 // 32 MB |
| 128 | resetBody = false |
| 129 | ) |
| 130 | |
| 131 | if conf != nil { |
| 132 | postMaxMemory = conf.GetPostMaxMemory() |
| 133 | resetBody = conf.GetDisableBodyConsumptionOnUnmarshal() |
| 134 | } |
| 135 | |
| 136 | getter := func(w http.ResponseWriter, r *http.Request) string { |
| 137 | return context.FormValueDefault(r, fieldName, "", postMaxMemory, resetBody) |
| 138 | } |
| 139 | |
| 140 | return Getter(getter) |
| 141 | } |
| 142 | |
| 143 | // Query specifies a url parameter name to use to determinate the method |
| 144 | // to override the POST methos with. |
no test coverage detected
searching dependent graphs…