(url string, timeout time.Duration)
| 198 | } |
| 199 | |
| 200 | func waitForHTTPServer(url string, timeout time.Duration) error { |
| 201 | start := time.Now() |
| 202 | client := &http.Client{Timeout: 1 * time.Second} |
| 203 | for time.Since(start) < timeout { |
| 204 | resp, err := client.Get(url) |
| 205 | if err == nil { |
| 206 | resp.Body.Close() |
| 207 | return nil |
| 208 | } |
| 209 | time.Sleep(500 * time.Millisecond) |
| 210 | } |
| 211 | return fmt.Errorf("timeout waiting for %s", url) |
| 212 | } |
| 213 | |
| 214 | // encodeTusMetadata encodes key-value pairs for Upload-Metadata header |
| 215 | func encodeTusMetadata(metadata map[string]string) string { |
no test coverage detected