mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 08:32:16 +01:00
docs(godoc): fix a bunch of typos
This commit is contained in:
@@ -26,7 +26,7 @@ func init() {
|
||||
gotenberg.MustRegisterModule(new(Api))
|
||||
}
|
||||
|
||||
// Api is a module which provides an HTTP server. Other modules may add routes,
|
||||
// Api is a module that provides an HTTP server. Other modules may add routes,
|
||||
// middlewares or health checks.
|
||||
type Api struct {
|
||||
port int
|
||||
@@ -60,7 +60,7 @@ type downloadFromConfig struct {
|
||||
disable bool
|
||||
}
|
||||
|
||||
// Router is a module interface which adds routes to the [Api].
|
||||
// Router is a module interface that adds routes to the [Api].
|
||||
type Router interface {
|
||||
Routes() ([]Route, error)
|
||||
}
|
||||
@@ -83,17 +83,17 @@ type Route struct {
|
||||
// Optional.
|
||||
DisableLogging bool
|
||||
|
||||
// Handler is the function which handles the request.
|
||||
// Handler is the function that handles the request.
|
||||
// Required.
|
||||
Handler echo.HandlerFunc
|
||||
}
|
||||
|
||||
// MiddlewareProvider is a module interface which adds middlewares to the [Api].
|
||||
// MiddlewareProvider is a module interface that adds middlewares to the [Api].
|
||||
type MiddlewareProvider interface {
|
||||
Middlewares() ([]Middleware, error)
|
||||
}
|
||||
|
||||
// MiddlewareStack is a type which helps to determine in which stack the
|
||||
// MiddlewareStack is a type that helps to determine in which stack the
|
||||
// middlewares provided by the [MiddlewareProvider] modules should be located.
|
||||
type MiddlewareStack uint32
|
||||
|
||||
@@ -103,7 +103,7 @@ const (
|
||||
MultipartStack
|
||||
)
|
||||
|
||||
// MiddlewarePriority is a type which helps to determine the execution order of
|
||||
// MiddlewarePriority is a type that helps to determine the execution order of
|
||||
// middlewares provided by the [MiddlewareProvider] modules in a stack.
|
||||
type MiddlewarePriority uint32
|
||||
|
||||
@@ -115,7 +115,7 @@ const (
|
||||
VeryHighPriority
|
||||
)
|
||||
|
||||
// Middleware is a middleware which can be added to the [Api]'s middlewares
|
||||
// Middleware is a middleware that can be added to the [Api]'s middlewares
|
||||
// chain.
|
||||
//
|
||||
// middleware := Middleware{
|
||||
@@ -157,7 +157,7 @@ type Middleware struct {
|
||||
Handler echo.MiddlewareFunc
|
||||
}
|
||||
|
||||
// HealthChecker is a module interface which allows adding health checks to the
|
||||
// HealthChecker is a module interface that allows adding health checks to the
|
||||
// API.
|
||||
//
|
||||
// See https://github.com/alexliesenfeld/health for more details.
|
||||
@@ -431,7 +431,7 @@ func (a *Api) Start() error {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the user wish to add logging entries related to the health
|
||||
// Check if the user wishes to add logging entries related to the health
|
||||
// check route.
|
||||
if a.disableHealthCheckLogging {
|
||||
disableLoggingForPaths = append(disableLoggingForPaths, "health")
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
// Package api provides a module which is an HTTP server. Other modules may
|
||||
// Package api provides a module, which is an HTTP server. Other modules may
|
||||
// add multipart/form-data routes, middlewares, and health checks.
|
||||
package api
|
||||
|
||||
@@ -27,7 +27,7 @@ type FormData struct {
|
||||
}
|
||||
|
||||
// Validate returns nil or an error related to the [FormData] values, with a
|
||||
// [SentinelHttpError] (status code 400, errors' details as message) wrapped
|
||||
// [SentinelHttpError] (status code 400, errors' details as a message) wrapped
|
||||
// inside.
|
||||
//
|
||||
// var foo string
|
||||
@@ -96,7 +96,7 @@ func (form *FormData) Int(key string, target *int, defaultValue int) *FormData {
|
||||
}
|
||||
|
||||
// MandatoryInt binds a form field to an int variable. It populates an
|
||||
// error if the value is not int, is empty, or the "key" does not exist.
|
||||
// error if the value is not int, or is empty, or the "key" does not exist.
|
||||
//
|
||||
// var foo int
|
||||
//
|
||||
@@ -116,7 +116,7 @@ func (form *FormData) Float64(key string, target *float64, defaultValue float64)
|
||||
}
|
||||
|
||||
// MandatoryFloat64 binds a form field to a float64 variable. It populates
|
||||
// an error if the is not float64, is empty, or the "key" does not exist.
|
||||
// an error if the value is not float64, is empty, or the "key" does not exist.
|
||||
//
|
||||
// var foo float64
|
||||
//
|
||||
@@ -136,8 +136,8 @@ func (form *FormData) Duration(key string, target *time.Duration, defaultValue t
|
||||
}
|
||||
|
||||
// MandatoryDuration binds a form field to a time.Duration variable. It
|
||||
// populates an error if the value is not time.Duration, is empty, or the "key"
|
||||
// does not exist.
|
||||
// populates an error if the value is not time.Duration, or is empty, or the
|
||||
// "key" does not exist.
|
||||
//
|
||||
// var foo time.Duration
|
||||
//
|
||||
@@ -146,7 +146,7 @@ func (form *FormData) MandatoryDuration(key string, target *time.Duration) *Form
|
||||
return form.mustMandatoryField(key, target)
|
||||
}
|
||||
|
||||
// Inches binds a form field to a float64 variable. It populates an error
|
||||
// Inches bind a form field to a float64 variable. It populates an error
|
||||
// if the value cannot be computed back to inches.
|
||||
//
|
||||
// var foo float64
|
||||
@@ -303,7 +303,7 @@ func (form *FormData) Path(filename string, target *string) *FormData {
|
||||
return form.path(filename, target)
|
||||
}
|
||||
|
||||
// MandatoryPath binds the absolute path ofa form data file to a string
|
||||
// MandatoryPath binds the absolute path of a form data file to a string
|
||||
// variable. It populates an error if the file does not exist.
|
||||
//
|
||||
// var path string
|
||||
@@ -348,7 +348,7 @@ func (form *FormData) MandatoryContent(filename string, target *string) *FormDat
|
||||
return form.readFile(path, filename, target)
|
||||
}
|
||||
|
||||
// Paths binds the absolute paths of form data files, according to a list of
|
||||
// Paths bind the absolute paths of form data files, according to a list of
|
||||
// file extensions, to a string slice variable.
|
||||
//
|
||||
// var paths []string
|
||||
@@ -379,7 +379,7 @@ func (form *FormData) MandatoryPaths(extensions []string, target *[]string) *For
|
||||
return form
|
||||
}
|
||||
|
||||
// paths binds the absolute paths of form data files, according to a list of
|
||||
// paths bind the absolute paths of form data files, according to a list of
|
||||
// file extensions, to a string slice variable.
|
||||
func (form *FormData) paths(extensions []string, target *[]string) *FormData {
|
||||
for filename, path := range form.files {
|
||||
|
||||
@@ -86,7 +86,7 @@ func httpErrorHandler() echo.HTTPErrorHandler {
|
||||
}
|
||||
|
||||
// latencyMiddleware sets the start time in the [echo.Context] under
|
||||
// "startTime". Its value will be used later to calculate a request latency.
|
||||
// "startTime". Its value will be used later to calculate request latency.
|
||||
//
|
||||
// startTime := c.Get("startTime").(time.Time)
|
||||
func latencyMiddleware() echo.MiddlewareFunc {
|
||||
@@ -109,7 +109,7 @@ func latencyMiddleware() echo.MiddlewareFunc {
|
||||
// rootPath := c.Get("rootPath").(string)
|
||||
// healthURI := fmt.Sprintf("%s/health", rootPath)
|
||||
//
|
||||
// // Skip the middleware if health check URI.
|
||||
// // Skip the middleware if it's the health check URI.
|
||||
// if c.Request().RequestURI == healthURI {
|
||||
// // Call the next middleware in the chain.
|
||||
// return next(c)
|
||||
@@ -241,7 +241,7 @@ func basicAuthMiddleware(username, password string) echo.MiddlewareFunc {
|
||||
})
|
||||
}
|
||||
|
||||
// contextMiddleware, a middleware for "multipart/form-data" requests, sets the
|
||||
// contextMiddleware, middleware for "multipart/form-data" requests, sets the
|
||||
// [Context] and related context.CancelFunc in the [echo.Context] under
|
||||
// "context" and "cancel". If the process is synchronous, it also handles the
|
||||
// result of a "multipart/form-data" request.
|
||||
@@ -256,7 +256,7 @@ func contextMiddleware(fs *gotenberg.FileSystem, timeout time.Duration, bodyLimi
|
||||
trace := c.Get("trace").(string)
|
||||
|
||||
// We create a context with a timeout so that underlying processes are
|
||||
// able to stop early and handle correctly a timeout scenario.
|
||||
// able to stop early and correctly handle a timeout scenario.
|
||||
ctx, cancel, err := newContext(c, logger, fs, timeout, bodyLimit, downloadFromCfg, traceHeader, trace)
|
||||
if err != nil {
|
||||
cancel()
|
||||
|
||||
@@ -54,7 +54,7 @@ func (ctx *ContextMock) SetFiles(files map[string]string) {
|
||||
ctx.files = files
|
||||
}
|
||||
|
||||
// SetCancelled sets if the context is cancelled or not.
|
||||
// SetCancelled sets if the context is canceled or not.
|
||||
//
|
||||
// ctx := &api.ContextMock{Context: &api.Context{}}
|
||||
// ctx.SetCancelled(true)
|
||||
@@ -120,7 +120,7 @@ func (provider *MiddlewareProviderMock) Middlewares() ([]Middleware, error) {
|
||||
return provider.MiddlewaresMock()
|
||||
}
|
||||
|
||||
// HealthCheckerMock is mock for the [HealthChecker] interface.
|
||||
// HealthCheckerMock is a mock for the [HealthChecker] interface.
|
||||
type HealthCheckerMock struct {
|
||||
ChecksMock func() ([]health.CheckerOption, error)
|
||||
ReadyMock func() error
|
||||
|
||||
Reference in New Issue
Block a user