Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cmd/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ EXAMPLES
}

// Flags
cmd.Flags().StringP("format", "f", "", "Format of message to send, 'http' or 'cloudevent'. Default is to choose automatically. ($FUNC_FORMAT)")
cmd.Flags().StringP("format", "f", "", "Format of message to send, 'http' or 'cloudevent(s)'. Default is to choose automatically. ($FUNC_FORMAT)")
cmd.Flags().StringP("target", "t", "", "Function instance to invoke. Can be 'local', 'remote' or a URL. Defaults to auto-discovery if not provided. ($FUNC_TARGET)")
cmd.Flags().StringP("id", "", "", "ID for the request data. ($FUNC_ID)")
cmd.Flags().StringP("source", "", fn.DefaultInvokeSource, "Source value for the request data. ($FUNC_SOURCE)")
Expand Down Expand Up @@ -259,6 +259,11 @@ func newInvokeConfig() (cfg invokeConfig, err error) {
cfg.Data = b
}

switch strings.ToLower(cfg.Format) {
case "cloudevent", "cloudevents":
cfg.Format = "cloudevent"
}

// if not in confirm/prompting mode, the cfg structure is complete.
if !cfg.Confirm {
return
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/func_invoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func invoke
--content-type string Content Type of the data. ($FUNC_CONTENT_TYPE) (default "application/json")
--data string Data to send in the request. ($FUNC_DATA) (default "{\"message\":\"Hello World\"}")
--file string Path to a file to use as data. Overrides --data flag and should be sent with a correct --content-type. ($FUNC_FILE)
-f, --format string Format of message to send, 'http' or 'cloudevent'. Default is to choose automatically. ($FUNC_FORMAT)
-f, --format string Format of message to send, 'http' or 'cloudevent(s)'. Default is to choose automatically. ($FUNC_FORMAT)
-h, --help help for invoke
--id string ID for the request data. ($FUNC_ID)
-i, --insecure Allow insecure server connections when using SSL. ($FUNC_INSECURE)
Expand Down
Loading