httplib: fix unstable test, do not use httplib.org
This commit is contained in:
@@ -67,13 +67,15 @@ type CustomFunc func(v *Validation, obj interface{}, key string)
|
||||
|
||||
// AddCustomFunc Add a custom function to validation
|
||||
// The name can not be:
|
||||
// Clear
|
||||
// HasErrors
|
||||
// ErrorMap
|
||||
// Error
|
||||
// Check
|
||||
// Valid
|
||||
// NoMatch
|
||||
//
|
||||
// Clear
|
||||
// HasErrors
|
||||
// ErrorMap
|
||||
// Error
|
||||
// Check
|
||||
// Valid
|
||||
// NoMatch
|
||||
//
|
||||
// If the name is same with exists function, it will replace the origin valid function
|
||||
func AddCustomFunc(name string, f CustomFunc) error {
|
||||
if unFuncs[name] {
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
// log.Println(v.Error.Key, v.Error.Message)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
package validation
|
||||
|
||||
import (
|
||||
|
||||
@@ -64,26 +64,27 @@ var once sync.Once
|
||||
|
||||
// SetDefaultMessage set default messages
|
||||
// if not set, the default messages are
|
||||
// "Required": "Can not be empty",
|
||||
// "Min": "Minimum is %d",
|
||||
// "Max": "Maximum is %d",
|
||||
// "Range": "Range is %d to %d",
|
||||
// "MinSize": "Minimum size is %d",
|
||||
// "MaxSize": "Maximum size is %d",
|
||||
// "Length": "Required length is %d",
|
||||
// "Alpha": "Must be valid alpha characters",
|
||||
// "Numeric": "Must be valid numeric characters",
|
||||
// "AlphaNumeric": "Must be valid alpha or numeric characters",
|
||||
// "Match": "Must match %s",
|
||||
// "NoMatch": "Must not match %s",
|
||||
// "AlphaDash": "Must be valid alpha or numeric or dash(-_) characters",
|
||||
// "Email": "Must be a valid email address",
|
||||
// "IP": "Must be a valid ip address",
|
||||
// "Base64": "Must be valid base64 characters",
|
||||
// "Mobile": "Must be valid mobile number",
|
||||
// "Tel": "Must be valid telephone number",
|
||||
// "Phone": "Must be valid telephone or mobile phone number",
|
||||
// "ZipCode": "Must be valid zipcode",
|
||||
//
|
||||
// "Required": "Can not be empty",
|
||||
// "Min": "Minimum is %d",
|
||||
// "Max": "Maximum is %d",
|
||||
// "Range": "Range is %d to %d",
|
||||
// "MinSize": "Minimum size is %d",
|
||||
// "MaxSize": "Maximum size is %d",
|
||||
// "Length": "Required length is %d",
|
||||
// "Alpha": "Must be valid alpha characters",
|
||||
// "Numeric": "Must be valid numeric characters",
|
||||
// "AlphaNumeric": "Must be valid alpha or numeric characters",
|
||||
// "Match": "Must match %s",
|
||||
// "NoMatch": "Must not match %s",
|
||||
// "AlphaDash": "Must be valid alpha or numeric or dash(-_) characters",
|
||||
// "Email": "Must be a valid email address",
|
||||
// "IP": "Must be a valid ip address",
|
||||
// "Base64": "Must be valid base64 characters",
|
||||
// "Mobile": "Must be valid mobile number",
|
||||
// "Tel": "Must be valid telephone number",
|
||||
// "Phone": "Must be valid telephone or mobile phone number",
|
||||
// "ZipCode": "Must be valid zipcode",
|
||||
func SetDefaultMessage(msg map[string]string) {
|
||||
if len(msg) == 0 {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user