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

sys/net/nanocoap: introduce Accept option helper #18772

Merged
merged 2 commits into from
Oct 20, 2022

Conversation

JKRhb
Copy link
Member

@JKRhb JKRhb commented Oct 19, 2022

Contribution description

Working with content negotiation in the context of gcoap/nanocoap, I noticed that it would be handy to be able to access the Accept option of a request more easily. Therefore, this PR adds a new helper function coap_get_accept that gets the respective option value from a CoAP packet. It reuses most of the code from the existing coap_get_content_type helper, moving its logic to a new internal function that is called by both coap_get_content_type and coap_get_accept.

Testing procedure

I adjusted the existing unit tests to assert that new the helper works.

Issues/PRs references

@github-actions github-actions bot added Area: CoAP Area: Constrained Application Protocol implementations Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework labels Oct 19, 2022
@miri64 miri64 added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: run tests If set, CI server will run tests on hardware for the labeled PR CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Oct 19, 2022
@riot-ci
Copy link

riot-ci commented Oct 19, 2022

Murdock results

✔️ PASSED

61d1516 tests/nanocoap: add unit test for Accept option helper

Success Failures Total Runtime
1993 0 1993 06m:43s

Artifacts

This only reflects a subset of all builds from https://ci-prod.riot-os.org. Please refer to https://ci.riot-os.org for a complete build for now.

tests/unittests/tests-nanocoap/tests-nanocoap.c Outdated Show resolved Hide resolved
tests/unittests/tests-nanocoap/tests-nanocoap.c Outdated Show resolved Hide resolved
Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

Please squash!

@miri64 miri64 enabled auto-merge October 19, 2022 15:00
@miri64 miri64 merged commit d759d2d into RIOT-OS:master Oct 20, 2022
@JKRhb JKRhb deleted the accept-helper branch October 20, 2022 09:26
@kaspar030 kaspar030 added this to the Release 2023.01 milestone Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CoAP Area: Constrained Application Protocol implementations Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants