MCPcopy Create free account
hub / github.com/Scalingo/cli / getURLInfo

Function getURLInfo

deployments/deploy_war.go:101–118  ·  view source on GitHub ↗
(ctx context.Context, warPath string)

Source from the content-addressed store, hash-verified

99}
100
101func getURLInfo(ctx context.Context, warPath string) (io.ReadCloser, int64, error) {
102 res, err := http.Get(warPath)
103 if err != nil {
104 return nil, 0, errors.Wrapf(ctx, err, "get WAR file")
105 }
106
107 warSize := int64(0)
108 warReadStream := res.Body
109 if res.Header.Get("Content-Length") != "" {
110 i, err := strconv.ParseInt(res.Header.Get("Content-Length"), 10, 64)
111 if err == nil {
112 // If there is an error, we just skip this header
113 warSize = i
114 }
115 }
116
117 return warReadStream, warSize, nil
118}
119
120func getFileInfo(ctx context.Context, warPath string) (io.ReadCloser, int64, string, error) {
121 warSize := int64(0)

Callers 1

DeployWarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected