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

Add Query Support #42

Merged
merged 1 commit into from
Mar 3, 2024
Merged

Conversation

YelloooBlue
Copy link

@YelloooBlue YelloooBlue commented Mar 3, 2024

When using this library, I have the same problem #37
I tried to make a few small modifications and it worked fine.

Before I added query support, queries were parsed as part of URI_PATH

coap.put(IPAddress(10, 0, 1, 1), 5683,"room/lights?n=bed&s=on","hello");

the Option will be resolved as

Option_URI_PATH : room
Option_URI_PATH : lights?n=bed&s=on

Based on the position of '/','?' and '&' characters, the path and query are separated

Option_URI_PATH : room
Option_URI_PATH : lights
Option_URI_QUERY : n=bed
Option_URI_QUERY : s=on

It supports the following cases:

  1. No URI_PATH parameter (root path)
  2. No URI_QUERY parameter
  3. Only URI_PATH without URI_QUERY.

The original functions are not affected.
Thanks.

@hirotakaster
Copy link
Owner

@YelloooBlue
Thank you for your PR.
I will test now.

@hirotakaster hirotakaster merged commit 391046f into hirotakaster:master Mar 3, 2024
2 checks passed
hirotakaster added a commit that referenced this pull request Mar 3, 2024
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.

2 participants