Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add CBOR support in EventClient for binary reading #550

Merged
merged 1 commit into from
Mar 18, 2021
Merged

feat: add CBOR support in EventClient for binary reading #550

merged 1 commit into from
Mar 18, 2021

Conversation

chr1shung
Copy link

Signed-off-by: Chris Hung chris@iotechsys.com

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/go-mod-core-contracts/blob/master/.github/Contributing.md.

What is the current behavior?

Issue Number: fix #543

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

New Imports

  • Yes
  • No

Specific Instructions

Are there any specific instructions or things that should be known prior to reviewing?

Other information

jsonEncodedData, err := json.Marshal(data)
if err != nil {
return nil, errors.NewCommonEdgeX(errors.KindContractInvalid, "failed to encode input data to JSON", err)
func createRequestWithRawData(ctx context.Context, httpMethod string, url string, data interface{}, cborEncoding bool) (*http.Request, errors.EdgeX) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use bool because we might have other encoding in the future.
please use string and leverage clients.ContentTypeCBOR / clients.ContentTypeJSON.

Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, once addressed @cloudxxx8 comment.

v2/clients/http/device.go Outdated Show resolved Hide resolved
v2/clients/http/event.go Outdated Show resolved Hide resolved
Signed-off-by: Chris Hung <chris@iotechsys.com>
Copy link
Member

@cloudxxx8 cloudxxx8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov-io
Copy link

Codecov Report

Merging #550 (c13f5d0) into master (954b5ff) will decrease coverage by 0.06%.
The diff coverage is 61.53%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #550      +/-   ##
==========================================
- Coverage   56.23%   56.17%   -0.07%     
==========================================
  Files         119      119              
  Lines        3551     3557       +6     
==========================================
+ Hits         1997     1998       +1     
- Misses       1357     1361       +4     
- Partials      197      198       +1     
Impacted Files Coverage Δ
v2/clients/http/event.go 67.69% <28.57%> (-5.19%) ⬇️
v2/clients/http/device.go 68.00% <100.00%> (ø)
v2/clients/http/deviceprofile.go 75.75% <100.00%> (ø)
v2/clients/http/deviceservice.go 70.58% <100.00%> (ø)
v2/clients/http/deviceservicecallback.go 63.63% <100.00%> (ø)
v2/clients/http/provisionwatcher.go 68.88% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 954b5ff...c13f5d0. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[V2] Add CBOR support in the Event client library
4 participants