Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(net/ghttp): Server Domain if is empty str, bind handler pattern will add @ which is not expect #4100#4101

Merged
hailaz merged 6 commits intogogf:masterfrom
elonnzhang:master
Sep 26, 2025
Merged

fix(net/ghttp): Server Domain if is empty str, bind handler pattern will add @ which is not expect #4100#4101
hailaz merged 6 commits intogogf:masterfrom
elonnzhang:master

Conversation

@elonnzhang
Copy link
Contributor

@elonnzhang elonnzhang commented Jan 7, 2025

fix #4100

gqcn
gqcn previously requested changes Jan 21, 2025
@houseme houseme requested a review from Copilot March 28, 2025 05:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where binding handler patterns would incorrectly include an "@" character when the server domain is an empty string. The changes refactor the string concatenation logic by introducing a helper function that conditionally adds the "@" separator.

  • Replaces inline concatenations with the new helper function patternBindDomain.
  • Updates all handler binding methods to use the helper function.
  • Introduces patternBindDomain to conditionally format the handler pattern.
Comments suppressed due to low confidence (2)

net/ghttp/ghttp_server_domain.go:170

  • [nitpick] Consider adding a brief documentation comment for the helper function 'patternBindDomain' to explain its behavior, especially its handling of empty domain strings.
func patternBindDomain(pattern, domain string) string {

net/ghttp/ghttp_server_domain.go:170

  • Consider adding unit tests for 'patternBindDomain', ensuring that the function behaves correctly with both empty and non-empty domain strings.
func patternBindDomain(pattern, domain string) string {

@hailaz hailaz dismissed gqcn’s stale review September 26, 2025 10:48

已经更新

@hailaz hailaz merged commit f172e61 into gogf:master Sep 26, 2025
18 checks passed
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.

net/ghttp: Server Domain if is empty str, bind handler pattern will add @ which is not expect

3 participants