MCPcopy
hub / github.com/seaweedfs/seaweedfs / NormalizeHttpScheme

Method NormalizeHttpScheme

weed/util/http/client/http_client.go:101–117  ·  view source on GitHub ↗
(rawURL string)

Source from the content-addressed store, hash-verified

99}
100
101func (httpClient *HTTPClient) NormalizeHttpScheme(rawURL string) (string, error) {
102 expectedScheme := httpClient.GetHttpScheme()
103
104 if !(strings.HasPrefix(rawURL, "http://") || strings.HasPrefix(rawURL, "https://")) {
105 return expectedScheme + "://" + rawURL, nil
106 }
107
108 parsedURL, err := url.Parse(rawURL)
109 if err != nil {
110 return "", err
111 }
112
113 if expectedScheme != parsedURL.Scheme {
114 parsedURL.Scheme = expectedScheme
115 }
116 return parsedURL.String(), nil
117}
118
119func NewHttpClient(clientName ClientName, opts ...HttpClientOpt) (*HTTPClient, error) {
120 httpClient := HTTPClient{}

Callers 5

GetMethod · 0.95
PostMethod · 0.95
PostFormMethod · 0.95
HeadMethod · 0.95
NormalizeUrlFunction · 0.80

Implementers 15

commandVolumeListweed/shell/command_volume_list.go
commandVolumeScrubweed/shell/command_volume_scrub.go
commandS3UserProvisionweed/shell/command_s3_user_provision.g
commandVolumeFixReplicationweed/shell/command_volume_fix_replicat
commandVolumeMarkweed/shell/command_volume_mark.go
commandS3AccessKeyDeleteweed/shell/command_s3_accesskey_delete
commandFsPwdweed/shell/command_fs_pwd.go
commandRaftServerRemoveweed/shell/command_cluster_raft_remove
commandFsDistributeChunksweed/shell/command_fs_distribute_chunk
commandEcRebuildweed/shell/command_ec_rebuild.go
commandS3GroupListweed/shell/command_s3_group_list.go
commandS3AnonymousSetweed/shell/command_s3_anonymous_set.go

Calls 3

GetHttpSchemeMethod · 0.95
ParseMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected