nicolaferraro commented on a change in pull request #156: Add option to run from URL URL: https://github.com/apache/camel-k/pull/156#discussion_r222672917
########## File path: pkg/client/cmd/run.go ########## @@ -97,10 +98,19 @@ func (*runCmdOptions) validateArgs(cmd *cobra.Command, args []string) error { return errors.New("accepts 1 arg, received " + strconv.Itoa(len(args))) } fileName := args[0] - if _, err := os.Stat(fileName); err != nil && os.IsNotExist(err) { - return errors.New("file " + fileName + " does not exist") - } else if err != nil { - return errors.New("error while accessing file " + fileName) + if !strings.HasPrefix(fileName, "http://") && !strings.HasPrefix(fileName, "https://") { + if _, err := os.Stat(fileName); err != nil && os.IsNotExist(err) { + return errors.New("file " + fileName + " does not exist") + } else if err != nil { + return errors.New("error while accessing file " + fileName) + } + } else { + resp, err := http.Get(fileName) + if err != nil { + return errors.New("The URL provided is not reachable " + fileName) + } else if resp.StatusCode != 200 { + return errors.New("The URL provided is not reachable " + fileName) Review comment: Same ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services