Prepending a slash to user input url if missing. (#547)
* Prepending a slash to user input url if missing. * Adding the url slash check for spec.
This commit is contained in:
@@ -274,6 +274,10 @@ func fnCreate(c *cli.Context) error {
|
|||||||
if len(triggerUrl) == 0 {
|
if len(triggerUrl) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if !strings.HasPrefix(triggerUrl, "/") {
|
||||||
|
triggerUrl = fmt.Sprintf("/%s", triggerUrl)
|
||||||
|
}
|
||||||
|
|
||||||
method := c.String("method")
|
method := c.String("method")
|
||||||
if len(method) == 0 {
|
if len(method) == 0 {
|
||||||
method = "GET"
|
method = "GET"
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ func htCreate(c *cli.Context) error {
|
|||||||
if len(triggerUrl) == 0 {
|
if len(triggerUrl) == 0 {
|
||||||
fatal("Need a trigger URL, use --url")
|
fatal("Need a trigger URL, use --url")
|
||||||
}
|
}
|
||||||
|
if !strings.HasPrefix(triggerUrl, "/") {
|
||||||
|
triggerUrl = fmt.Sprintf("/%s", triggerUrl)
|
||||||
|
}
|
||||||
|
|
||||||
method := c.String("method")
|
method := c.String("method")
|
||||||
if len(method) == 0 {
|
if len(method) == 0 {
|
||||||
method = "GET"
|
method = "GET"
|
||||||
|
|||||||
@@ -246,6 +246,9 @@ func parseYaml(path string, b []byte, fr *FissionResources) error {
|
|||||||
warn(fmt.Sprintf("Failed to parse %v in %v: %v", tm.Kind, path, err))
|
warn(fmt.Sprintf("Failed to parse %v in %v: %v", tm.Kind, path, err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if !strings.HasPrefix(v.Spec.RelativeURL, "/") {
|
||||||
|
v.Spec.RelativeURL = fmt.Sprintf("/%s", v.Spec.RelativeURL)
|
||||||
|
}
|
||||||
fr.httpTriggers = append(fr.httpTriggers, v)
|
fr.httpTriggers = append(fr.httpTriggers, v)
|
||||||
case "KubernetesWatchTrigger":
|
case "KubernetesWatchTrigger":
|
||||||
var v crd.KubernetesWatchTrigger
|
var v crd.KubernetesWatchTrigger
|
||||||
|
|||||||
Reference in New Issue
Block a user