MCPcopy Create free account
hub / github.com/gotenberg/gotenberg / Validate

Method Validate

pkg/modules/api/formdata.go:56–65  ·  view source on GitHub ↗

Validate returns nil or an error related to the [FormData] values, with a [SentinelHttpError] (status code 400, errors' details as a message) wrapped inside. var foo string err := ctx.FormData(). MandatoryString("foo", &foo, "bar"). Validate()

()

Source from the content-addressed store, hash-verified

54// MandatoryString("foo", &foo, "bar").
55// Validate()
56func (form *FormData) Validate() error {
57 if form.errors == nil {
58 return nil
59 }
60
61 return WrapError(
62 form.errors,
63 NewSentinelHttpError(http.StatusBadRequest, fmt.Sprintf("Invalid form data: %s", form.errors)),
64 )
65}
66
67// String binds a form field to a string variable.
68//

Callers

nothing calls this directly

Calls 2

WrapErrorFunction · 0.85
NewSentinelHttpErrorFunction · 0.85

Tested by

no test coverage detected