Skip to content

Commit

Permalink
Fix the Content Header-related issue with CBOR.
Browse files Browse the repository at this point in the history
Signed-off-by: Akram Ahmad <sftwr2020@gmail.com>
  • Loading branch information
akramtexas committed Apr 9, 2020
1 parent b92b1a4 commit 1556322
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 48 deletions.
3 changes: 3 additions & 0 deletions example/cmd/device-simple/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ https://github.com/pmezard/go-difflib/blob/master/LICENSE
stretchr/testify (MIT) https://github.com/stretchr/testify
https://github.com/stretchr/testify/blob/master/LICENSE

ugorji/go (MIT) https://github.com/ugorji/go
https://github.com/ugorji/go/blob/master/LICENSE

kr/logfmt (MIT) https://github.com/kr/logfmt
https://github.com/kr/logfmt/blob/master/Readme

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/gorilla/mux v1.7.1
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.5.1
github.com/ugorji/go v1.1.4
gopkg.in/yaml.v2 v2.2.8
)

Expand Down
5 changes: 3 additions & 2 deletions internal/autoevent/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import (
"sync"
"time"

"github.com/OneOfOne/xxhash"
"github.com/edgexfoundry/device-sdk-go/internal/common"
"github.com/edgexfoundry/device-sdk-go/internal/handler"
dsModels "github.com/edgexfoundry/device-sdk-go/pkg/models"
contract "github.com/edgexfoundry/go-mod-core-contracts/models"

"github.com/OneOfOne/xxhash"
)

type Executor interface {
Expand Down Expand Up @@ -80,7 +81,7 @@ func readResource(e *executor) (*dsModels.Event, common.AppError) {
vars[common.NameVar] = e.deviceName
vars[common.CommandVar] = e.autoEvent.Resource

evt, appErr := handler.CommandHandler(vars, "", common.GetCmdMethod, "")
evt, appErr := handler.CommandHandler(vars, "", nil)
return evt, appErr
}

Expand Down
3 changes: 2 additions & 1 deletion internal/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import (
// WritableInfo is a struct which contains configuration settings that can be changed in the Registry .
type WritableInfo struct {
// Level is the logging level of writing log message
LogLevel string
LogLevel string
ChecksumAlgo string
}

// ServiceInfo is a struct which contains service related configuration
Expand Down
5 changes: 3 additions & 2 deletions internal/controller/restfuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/edgexfoundry/device-sdk-go/internal/handler/callback"
"github.com/edgexfoundry/go-mod-core-contracts/clients"
contract "github.com/edgexfoundry/go-mod-core-contracts/models"

"github.com/gorilla/mux"
)

Expand Down Expand Up @@ -105,7 +106,7 @@ func commandFunc(w http.ResponseWriter, req *http.Request) {
return
}

event, appErr := handler.CommandHandler(vars, body, req.Method, req.URL.RawQuery)
event, appErr := handler.CommandHandler(vars, body, req)

if appErr != nil {
http.Error(w, fmt.Sprintf("%s %s", appErr.Message(), req.URL.Path), appErr.Code())
Expand Down Expand Up @@ -149,7 +150,7 @@ func commandAllFunc(w http.ResponseWriter, req *http.Request) {
return
}

events, appErr := handler.CommandAllHandler(vars[common.CommandVar], body, req.Method, req.URL.RawQuery)
events, appErr := handler.CommandAllHandler(vars[common.CommandVar], body, req)
if appErr != nil {
http.Error(w, appErr.Message(), appErr.Code())
} else if len(events) > 0 {
Expand Down
Loading

0 comments on commit 1556322

Please sign in to comment.