Skip to content

Commit

Permalink
docs(hertz): function signature error (#1114)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyenought authored Jul 30, 2024
1 parent e4da60e commit 03e698d
Show file tree
Hide file tree
Showing 54 changed files with 486 additions and 488 deletions.
4 changes: 2 additions & 2 deletions content/en/blog/releases/Hertz/release-v080.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Hertz added support for Partitioned Cookies in v0.8.0. You need to upgrade to >
Currently, Hertz supports Partitioned Cookies, but does not yet support passing whether it is Partitioned through SetCookie. We will add this feature in the next minor version. Before that, you can refer to the following code example to use Partitioned Cookies.

```
func SetPartitionedCookie(ctx *app.RequestContext, name, value string, maxAge int, path, domain string, sameSite protocol.CookieSameSite, secure, httpOnly bool) {
func SetPartitionedCookie(c *app.RequestContext, name, value string, maxAge int, path, domain string, sameSite protocol.CookieSameSite, secure, httpOnly bool) {
if path == "" {
path = "/"
}
Expand All @@ -54,7 +54,7 @@ func SetPartitionedCookie(ctx *app.RequestContext, name, value string, maxAge in
cookie.SetHTTPOnly(httpOnly)
cookie.SetSameSite(sameSite)
cookie.SetPartitioned(true)
ctx.Response.Header.SetCookie(cookie)
c.Response.Header.SetCookie(cookie)
}
func main() {
Expand Down
2 changes: 1 addition & 1 deletion content/en/docs/hertz/getting-started/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ After completing the environment preparation, you can quickly start the Hertz Se
h := server.Default()

h.GET("/ping", func(ctx context.Context, c *app.RequestContext) {
ctx.JSON(consts.StatusOK, utils.H{"message": "pong"})
c.JSON(consts.StatusOK, utils.H{"message": "pong"})
})

h.Spin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func main() {
> hertz version >= v0.7.0
| API | Description |
| :-------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|:----------------------| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ctx.BindAndValidate | Use the following go-tag for parameter binding, and do a parameter validation after successful binding (if there is a validation tag) |
| ctx.Bind | Same as `BindAndValidate` but without parameter validation |
| ctx.BindQuery | Bind all Query parameters, which is equivalent to declaring a `query` tag for each field, for scenarios where no tag is written |
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/hertz/tutorials/basic-feature/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func performRequest() {
func main() {
h := server.New(server.WithHostPorts(":8080"))
h.GET("/hello", func(ctx context.Context, c *app.RequestContext) {
ctx.JSON(consts.StatusOK, "hello hertz")
c.JSON(consts.StatusOK, "hello hertz")
})
go performRequest()
h.Spin()
Expand Down Expand Up @@ -749,7 +749,7 @@ The `UseAsLast` function adds the middleware to the end of the client middleware

If the client middleware chain has already set the last middleware before, the `UseAsLast` function will return an `errorLastMiddlewareExist` error. Therefore, to ensure that the last middleware in the client middleware chain is empty, you can first use the [TakeOutLastMiddleware](#takeoutlastmiddleware) function to clear the last middleware in the client middleware chain.

> Note: The `UseAsLast` function sets the middleware in `c.lastMiddleware`, while the middleware chain set using the [Use](#use) function is stored in `c.mws`. The two functions are relatively independent. `c.lastMiddleware` is executed only at the end of the client middleware chain. Therefore, the `UseAsLast` function can be called before or after the [Use](#use) function.
> Note: The `UseAsLast` function sets the middleware in `ctx.lastMiddleware`, while the middleware chain set using the [Use](#use) function is stored in `ctx.mws`. The two functions are relatively independent. `ctx.lastMiddleware` is executed only at the end of the client middleware chain. Therefore, the `UseAsLast` function can be called before or after the [Use](#use) function.

Function Signature:

Expand Down
Loading

0 comments on commit 03e698d

Please sign in to comment.