Skip to content

Commit

Permalink
Add content_type from newer connector-sdk version
Browse files Browse the repository at this point in the history
This change sets a content_type for messages sent to functions

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Jul 17, 2021
1 parent 779c63f commit a6b0364
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 107 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM teamserverless/license-check:0.3.9 as license-check

FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.15 as build
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16 as build

ARG GIT_COMMIT
ARG VERSION
Expand Down
63 changes: 0 additions & 63 deletions Gopkg.lock

This file was deleted.

38 changes: 0 additions & 38 deletions Gopkg.toml

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.15

require (
github.com/eclipse/paho.mqtt.golang v1.2.0
github.com/openfaas/connector-sdk v0.0.0-20201220114541-89f0ffcc5448
github.com/openfaas/connector-sdk v0.6.1
github.com/openfaas/faas-provider v0.17.1
golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/openfaas/connector-sdk v0.0.0-20201220114541-89f0ffcc5448 h1:gHh56/nHvUPTcFyXszTOrPJePCg2Q3JKln11G1IU3PU=
github.com/openfaas/connector-sdk v0.0.0-20201220114541-89f0ffcc5448/go.mod h1:hxiCgJmfEWQj17jwnr8yj1qbxQAqRPcudKU53lIu/QI=
github.com/openfaas/connector-sdk v0.6.1 h1:nVhJFKSTrFSgKMcYKCeGPW4gsS64A/inmsUu40J6xso=
github.com/openfaas/connector-sdk v0.6.1/go.mod h1:hxiCgJmfEWQj17jwnr8yj1qbxQAqRPcudKU53lIu/QI=
github.com/openfaas/faas-provider v0.16.1/go.mod h1:fq1JL0mX4rNvVVvRLaLRJ3H6o667sHuyP5p/7SZEe98=
github.com/openfaas/faas-provider v0.17.1 h1:P5xTLN+/08PLLh4auIlO/PaUD/J3BUTmaC3en8N5zbs=
github.com/openfaas/faas-provider v0.17.1/go.mod h1:fq1JL0mX4rNvVVvRLaLRJ3H6o667sHuyP5p/7SZEe98=
Expand Down
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ func main() {
creds = types.GetCredentials()
}

contentType := "application/json"
if v, exists := os.LookupEnv("content_type"); exists && len(v) > 0 {
contentType = v
}

gatewayURL := os.Getenv("gateway_url")

if len(gatewayFlag) > 0 {
Expand All @@ -71,6 +76,7 @@ func main() {
PrintResponseBody: true,
TopicAnnotationDelimiter: ",",
AsyncFunctionInvocation: asyncInvoke,
ContentType: contentType,
}

log.Printf("Topic: %q\tBroker: %q\n", topic, broker)
Expand Down
5 changes: 5 additions & 0 deletions vendor/github.com/openfaas/connector-sdk/types/controller.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions vendor/github.com/openfaas/connector-sdk/types/invoker.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## explicit
github.com/eclipse/paho.mqtt.golang
github.com/eclipse/paho.mqtt.golang/packets
# github.com/openfaas/connector-sdk v0.0.0-20201220114541-89f0ffcc5448
# github.com/openfaas/connector-sdk v0.6.1
## explicit
github.com/openfaas/connector-sdk/types
# github.com/openfaas/faas-provider v0.17.1
Expand Down

0 comments on commit a6b0364

Please sign in to comment.