Skip to content

Commit a5d9b9b

Browse files
authored
docs(hertz): update config/engine/client docs for latest Hertz behavior (#1533)
1 parent 6aa53a2 commit a5d9b9b

18 files changed

Lines changed: 205 additions & 105 deletions

File tree

content/en/docs/hertz/faq/_index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ For very vast requests cases, use a combination of streaming and go net.
3535

3636
If the framework reports the following error codes, you can check it for possible causes. If there is an error code other than the following, the error code is not caused by the framework and needs to be located by the user to see whether it is set by itself or by some middleware.
3737

38+
### 403
39+
40+
This status code is returned only when the `fs` feature is enabled and a directory index is accessed without permission. Hertz does not return `403` in other scenarios.
41+
3842
### 404
3943

4044
1. Access to the wrong port, commonly access to the debug port.
@@ -43,10 +47,18 @@ If the framework reports the following error codes, you can check it for possibl
4347
1. Check whether all expected routes are registered correctly based on the startup log.
4448
2. Check that the access method is correct.
4549

50+
### 413
51+
52+
The request body sent by the client exceeds the maximum size configured by [`WithMaxRequestBodySize`](../reference/config.md) on the server side. The default limit is 4 MB.
53+
4654
### 417
4755

4856
The server returns `false` after executing the custom `ContinueHandler` (the server actively rejects the subsequent body of the 100 Continue).
4957

58+
### 431
59+
60+
The request header sent by the client exceeds the maximum size configured by [`WithMaxHeaderBytes`](../reference/config.md) on the server side. The default limit is 1 MB.
61+
5062
### 500
5163

5264
1. Throwing the panic in middleware or in `handlerFunc`.

content/en/docs/hertz/getting-started/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: "Preparation of Hertz development environment, quick start, and bas
1010
## Set Up Golang Development Environment
1111

1212
1. If you haven't set up your Golang environment yet, you can refer to [Golang Install](https://go.dev/doc/install).
13-
2. We recommend that you use the latest version of Golang, or make sure it's >= v1.16. You can choose to use the earlier versions, but the compatibility and stability are not guaranteed.
13+
2. We recommend that you use the latest version of Golang, or make sure it's >= v1.19. You can choose to use the earlier versions, but the compatibility and stability are not guaranteed.
1414
3. Make sure the go mod support is enabled (for Golang versions >= v1.15, it is enabled by default).
1515

1616
> Currently, Hertz supports Linux, macOS, and Windows systems.

content/en/docs/hertz/reference/config.md

Lines changed: 13 additions & 20 deletions
Large diffs are not rendered by default.

content/en/docs/hertz/reference/version.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ description: "Hertz version description."
88

99
Hertz complies with the [Semantic Version 2.0.0](https://semver.org/lang/zh-CN/) release version.
1010

11+
**Current Version: [![Release](https://img.shields.io/github/v/release/cloudwego/hertz)](https://github.com/cloudwego/hertz/releases)**
12+
1113
- Master version number: Upgrade this version number if the API provided by Hertz becomes incompatible
1214
- Secondary version number: Upgrade this version number when Hertz provides new features while maintaining backward compatibility
1315
- Revision number: Upgrade this version number when Hertz's code provides minor features or backward-compatible optimizations and issue fixes
16+
17+
## Release Notes
18+
19+
See [GitHub Releases](https://github.com/cloudwego/hertz/releases).

content/en/docs/hertz/tutorials/basic-feature/adaptor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ func main() {
6161

6262
| Function | Function Signature | Description |
6363
| ------------------ | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
64-
| GetCompatRequest | `func GetCompatRequest(req *protocol.Request) (*http.Request, error)` | Build and fetch Go standard library `http.Request` from Hertz `protocol.Request` |
64+
| ~~GetCompatRequest~~ | `func GetCompatRequest(req *protocol.Request) (*http.Request, error)` | **Deprecated: Please use [`adaptor.HertzHandler`](./http-adaptor.md) instead.** Build and fetch Go standard library `http.Request` from Hertz `protocol.Request` |
6565
| CopyToHertzRequest | `func CopyToHertzRequest(req *http.Request, hreq *protocol.Request)` | Copy the `URI`, `Host`, `Method`, `Protocol`, `Header` of Go standard library `http.Request` to Hertz `protocol.Request`, The `Body` field will be adapted by sharing `Reader` |
6666

6767
## http.ResponseWriter
6868

6969
| Function / Struct | Function Signature | Description |
7070
| ----------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
71-
| GetCompatResponseWriter | `func GetCompatResponseWriter(resp *protocol.Response) http.ResponseWriter` | Build and fetch Go standard library `http.ResponseWriter` from Hertz `protocol.Response` |
71+
| ~~GetCompatResponseWriter~~ | `func GetCompatResponseWriter(resp *protocol.Response) http.ResponseWriter` | **Deprecated: Please use [`adaptor.HertzHandler`](./http-adaptor.md) instead.** Build and fetch Go standard library `http.ResponseWriter` from Hertz `protocol.Response` |
7272
| compatResponse | / | `compatResponse` implements the `http.ResponseWriter` interface and has adaptations to `Header`, `Write` and `WriteHeader` functions |
7373

7474
## Handler

content/en/docs/hertz/tutorials/basic-feature/client.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ func main() {
5555
| **Option** | **Default** | **Description** |
5656
| --------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
5757
| WithDialTimeout | 1s | dial timeout. |
58-
| WithMaxConnsPerHost | 512 | maximum number of connections per host which may be established. |
58+
| WithMaxConnsPerHost | 0 | maximum number of connections per host which may be established. Default 0 means unlimited. |
5959
| WithMaxIdleConnDuration | 10s | max idle connection duration, idle keep-alive connections are closed after this duration. |
6060
| WithMaxConnDuration | 0s | max connection duration, keep-alive connections are closed after this duration. |
6161
| WithMaxConnWaitTimeout | 0s | maximum duration for waiting for a free connection. |
6262
| WithKeepAlive | true | determines whether use keep-alive connection, default use. |
63-
| WithClientReadTimeout | 0s | maximum duration for full response reading (including body). |
63+
| WithClientReadTimeout | 0s | maximum duration for full response reading (including body). Default 0 means unlimited |
6464
| WithTLSConfig | nil | tlsConfig to create a tls connection, for specific configuration information, please refer to [tls](/docs/hertz/tutorials/basic-feature/tls/). |
65-
| WithDialer | network.Dialer | specific dialer. |
65+
| WithDialer | network.Dialer | specific dialer. The default depends on platform: netpoll on linux/darwin with amd64/arm64 when `HERTZ_NO_NETPOLL=true` is not set; falls back to standard for TLS; standard otherwise. |
6666
| WithResponseBodyStream | false | determine whether read body in stream or not, default not read in stream. |
6767
| WithDisableHeaderNamesNormalizing | false | whether disable header names normalizing, default not disabled, for example, cONTENT-lenGTH -> Content-Length. |
6868
| WithName | "" | set client name which used in User-Agent Header. |
6969
| WithNoDefaultUserAgentHeader | false | whether default no User-Agent header, default with User-Agent header. |
7070
| WithDisablePathNormalizing | false | whether disable path normalizing, default specification path, for example, http://localhost:8080/hello/../ hello -> http://localhost:8080/hello. |
71-
| WithRetryConfig | nil | retry configuration, for specific configuration information, please refer to [retry](/docs/hertz/tutorials/basic-feature/retry/). |
72-
| WithWriteTimeout | 0s | write timeout. |
71+
| WithRetryConfig | nil | retry configuration. Not enabled by default; calling it sets `MaxAttemptTimes=1` (no retry). To enable retry, set explicitly. For details see [retry](/docs/hertz/tutorials/basic-feature/retry/). |
72+
| WithWriteTimeout | 0s | write timeout. Default 0 means unlimited. |
7373
| WithConnStateObserve | nil, 5s | set function to observe and record the connection status of HTTP client, as well as observe execution intervals. |
7474
| WithDialFunc | network.Dialer | set dialer function. |
7575
| WithHostClientConfigHook | nil | Set the hook function for re-configure the host client. |

0 commit comments

Comments
 (0)