diff --git a/scan.go b/scan.go index f4fb0ad..d35c214 100644 --- a/scan.go +++ b/scan.go @@ -15,17 +15,23 @@ func upload(directory string) { url := fmt.Sprintf("http://127.0.0.1:8000/subscriber/%s/%s/manifest/upload", string(tideliftYML.TeamName), string(tideliftYML.RepositoryName)) // TODO: Add revision - var body = map[string]string{ + var body = map[string][]string{ // maybe use httpclient.addFormFile and do everything manually... // https://github.com/ddliu/go-httpclient/blob/master/httpclient.go#L676 - "@files[]": fileNames[0], // TODO: Add multiple files + "@files[]": fileNames, } - _, err := httpclient.WithHeaders(map[string]string{ + cwd, err := os.Getwd() + check(err) + os.Chdir(directory) + + _, err = httpclient.WithHeaders(map[string]string{ "Authorization": auth, }).Post(url, body) check(err) + os.Chdir(cwd) + fmt.Println(body) }