mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-18 05:47:32 +00:00
2c97794538
* feat: nice error messages * feat: nice error messages * fix: add project type * fix: message ids * handle error messages in login * add some better error messages * fix: better error messages on login * fix: better error messages on login * fix: add internal errors * fix: tests
28 lines
481 B
Go
28 lines
481 B
Go
package form
|
|
|
|
import (
|
|
"github.com/caos/zitadel/internal/errors"
|
|
"net/http"
|
|
|
|
"github.com/gorilla/schema"
|
|
)
|
|
|
|
type Parser struct {
|
|
decoder *schema.Decoder
|
|
}
|
|
|
|
func NewParser() *Parser {
|
|
d := schema.NewDecoder()
|
|
d.IgnoreUnknownKeys(true)
|
|
return &Parser{d}
|
|
}
|
|
|
|
func (p *Parser) Parse(r *http.Request, data interface{}) error {
|
|
err := r.ParseForm()
|
|
if err != nil {
|
|
return errors.ThrowInternal(err, "FORM-lCC9zI", "Errors.Internal")
|
|
}
|
|
|
|
return p.decoder.Decode(data, r.Form)
|
|
}
|