extractBaseURL 从完整URL中提取基础URL 例如: http://192.168.1.218:8080/api/application/cd3006e4-6051-11f0-97a0-0242ac110002 -> http://192.168.1.218:8080
(fullURL string)
| 128 | // extractBaseURL 从完整URL中提取基础URL |
| 129 | // 例如: http://192.168.1.218:8080/api/application/cd3006e4-6051-11f0-97a0-0242ac110002 -> http://192.168.1.218:8080 |
| 130 | func extractBaseURL(fullURL string) (string, error) { |
| 131 | if fullURL == "" { |
| 132 | return "", fmt.Errorf("base URL cannot be empty") |
| 133 | } |
| 134 | |
| 135 | // 解析URL |
| 136 | parsedURL, err := url.Parse(fullURL) |
| 137 | if err != nil { |
| 138 | return "", fmt.Errorf("invalid URL format: %v", err) |
| 139 | } |
| 140 | |
| 141 | // 构建基础URL (scheme + host) |
| 142 | baseURL := fmt.Sprintf("%s://%s", parsedURL.Scheme, parsedURL.Host) |
| 143 | return baseURL, nil |
| 144 | } |
| 145 | |
| 146 | // makeMaxKBRequest 发起MaxKB API请求 |
| 147 | func makeMaxKBRequest(url, applicationToken string) ([]byte, error) { |
no test coverage detected