[GIN-001] - Add TOML bining for gin (#3081)
Co-authored-by: GitstartHQ <gitstart@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
aa6002134e
commit
ed03102ef0
@@ -20,6 +20,7 @@ const (
|
||||
MIMEMultipartPOSTForm = "multipart/form-data"
|
||||
MIMEPROTOBUF = "application/x-protobuf"
|
||||
MIMEYAML = "application/x-yaml"
|
||||
MIMETOML = "application/toml"
|
||||
)
|
||||
|
||||
// Binding describes the interface which needs to be implemented for binding the
|
||||
@@ -79,6 +80,7 @@ var (
|
||||
YAML = yamlBinding{}
|
||||
Uri = uriBinding{}
|
||||
Header = headerBinding{}
|
||||
TOML = tomlBinding{}
|
||||
)
|
||||
|
||||
// Default returns the appropriate Binding instance based on the HTTP method
|
||||
@@ -99,6 +101,8 @@ func Default(method, contentType string) Binding {
|
||||
return YAML
|
||||
case MIMEMultipartPOSTForm:
|
||||
return FormMultipart
|
||||
case MIMETOML:
|
||||
return TOML
|
||||
default: // case MIMEPOSTForm:
|
||||
return Form
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user