mirror of https://github.com/gofiber/fiber.git
🐛 bug: make Render bind parameter type any again (#3270)
* 🐛 bug: make Render bind parameter type any again
* update docs
pull/3273/head
parent
d5771a34df
commit
5355869d4d
2
ctx.go
2
ctx.go
|
@ -1369,7 +1369,7 @@ func (c *DefaultCtx) GetRouteURL(routeName string, params Map) (string, error) {
|
|||
|
||||
// Render a template with data and sends a text/html response.
|
||||
// We support the following engines: https://github.com/gofiber/template
|
||||
func (c *DefaultCtx) Render(name string, bind Map, layouts ...string) error {
|
||||
func (c *DefaultCtx) Render(name string, bind any, layouts ...string) error {
|
||||
// Get new buffer from pool
|
||||
buf := bytebufferpool.Get()
|
||||
defer bytebufferpool.Put(buf)
|
||||
|
|
|
@ -12,8 +12,7 @@ import (
|
|||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// Ctx represents the Context which hold the HTTP request and response.
|
||||
// It has methods for the request query string, parameters, body, HTTP headers and so on.
|
||||
// Ctx represents the Context which hold the HTTP request and response.\nIt has methods for the request query string, parameters, body, HTTP headers and so on.
|
||||
type Ctx interface {
|
||||
// Accepts checks if the specified extensions or content types are acceptable.
|
||||
Accepts(offers ...string) string
|
||||
|
@ -263,7 +262,7 @@ type Ctx interface {
|
|||
GetRouteURL(routeName string, params Map) (string, error)
|
||||
// Render a template with data and sends a text/html response.
|
||||
// We support the following engines: https://github.com/gofiber/template
|
||||
Render(name string, bind Map, layouts ...string) error
|
||||
Render(name string, bind any, layouts ...string) error
|
||||
renderExtensions(bind any)
|
||||
// Route returns the matched Route struct.
|
||||
Route() *Route
|
||||
|
|
|
@ -1506,7 +1506,7 @@ app.Get("/teapot", func(c fiber.Ctx) error {
|
|||
Renders a view with data and sends a `text/html` response. By default, `Render` uses the default [**Go Template engine**](https://pkg.go.dev/html/template/). If you want to use another view engine, please take a look at our [**Template middleware**](https://docs.gofiber.io/template).
|
||||
|
||||
```go title="Signature"
|
||||
func (c fiber.Ctx) Render(name string, bind Map, layouts ...string) error
|
||||
func (c fiber.Ctx) Render(name string, bind any, layouts ...string) error
|
||||
```
|
||||
|
||||
## Request
|
||||
|
|
Loading…
Reference in New Issue