Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

docs(hertz): fix doc about client Get and Post #1419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
DMwangnima merged 1 commit into cloudwego:main from gaspardruan:patch-client
Sep 18, 2025

Conversation

@gaspardruan
Copy link
Contributor

@gaspardruan gaspardruan commented Sep 15, 2025

What type of PR is this?

docs: Documentation only changes

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.

(Optional) Translate the PR title into Chinese.

更正关于客户端Get和Post请求的文档。

(Optional) More detailed description for this PR(en: English/zh: Chinese).

Before:
Get 函数返回 URL 的状态码和响应体。如果 dst 太小,则将被响应体替换并返回,否则将分配一个新的切片。
Post 函数使用给定的 POST 参数向指定的 URL 发送 POST 请求。如果 dst 太小,则将被响应体替换并返回,否则将分配一个新的切片。

Now:
Get 函数返回 URL 的状态码和响应体。dst 将被响应体替换并返回,如果 dst 太小,将分配一个新的切片。
Post 函数使用给定的 POST 参数向指定的 URL 发送 POST 请求。dst 将被响应体替换并返回,如果 dst 太小,则将分配一个新的切片。

Source Code:

// Get returns the status code and body of url.
//
// The contents of dst will be replaced by the body and returned, if the dst
// is too small a new slice will be allocated.
//
// The function follows redirects. Use Do* for manually handling redirects.
func (c *Client) Get(ctx context.Context, dst []byte, url string, requestOptions ...config.RequestOption) (statusCode int, body []byte, err error) {
	return client.GetURL(ctx, dst, url, c, requestOptions...)
}
// Post sends POST request to the given url with the given POST arguments.
//
// The contents of dst will be replaced by the body and returned, if the dst
// is too small a new slice will be allocated.
//
// The function follows redirects. Use Do* for manually handling redirects.
//
// Empty POST body is sent if postArgs is nil.
func (c *Client) Post(ctx context.Context, dst []byte, url string, postArgs *protocol.Args, requestOptions ...config.RequestOption) (statusCode int, body []byte, err error) {
	return client.PostURL(ctx, dst, url, postArgs, c, requestOptions...)
}

Copy link

netlify bot commented Sep 15, 2025
edited
Loading

Deploy Preview for cloudwego ready!

Name Link
🔨 Latest commit 98fd855
🔍 Latest deploy log https://app.netlify.com/projects/cloudwego/deploys/68cac11564a52d0008718aaf
😎 Deploy Preview https://deploy-preview-1419--cloudwego.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@DMwangnima DMwangnima merged commit 627de0d into cloudwego:main Sep 18, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@GuangmingLuo GuangmingLuo GuangmingLuo left review comments

@DMwangnima DMwangnima DMwangnima approved these changes

Assignees

No one assigned

Labels

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /