Skip to content
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

feat(net/ghttp): add default value support ​​for retrieving header value #4090

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sanrentai
Copy link
Contributor

feat(net/ghttp): support setting default values ​​for header #4078

@@ -151,8 +151,14 @@ func (r *Request) IsExited() bool {
}

// GetHeader retrieves and returns the header value with given `key`.
func (r *Request) GetHeader(key string) string {
return r.Header.Get(key)
func (r *Request) GetHeader(key string, def ...string) string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add associated unit testing case for this update.

@@ -30,6 +34,13 @@ func (d *Driver) Open(config *gdb.ConfigNode) (db *sql.DB, err error) {
)
return nil, err
}
if err = db.QueryRow("SELECT @@VERSION").Scan(&version); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why adding this update in this PR?

@gqcn gqcn changed the title support setting default values ​​for header feat(net/ghttp): add default value support ​​for retrieving header value Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants