-
Notifications
You must be signed in to change notification settings - Fork 5
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 support of Option without value in Uri-Query. #45
Comments
Currently empty query value can be placed in such way: |
Nope that does not match the LWM2M specification 😬 See for Q option : |
Currently I parse UriQuery by myself using : // TODO remove this class when https://github.com/open-coap/java-coap/issues/45 will be fixed.
public class QueryUtil {
public static Map<String, String> parseUriQuery(String uriQuery) {
if (uriQuery == null || uriQuery.length() == 0) {
return Collections.emptyMap();
}
Map<String, String> result = new LinkedHashMap<>();
String[] params = uriQuery.substring(uriQuery.indexOf('?') + 1).split("&");
for (String prm : params) {
String[] p = prm.split("=", 2);
if (p.length == 2) {
result.put(p[0], p[1]);
} else if (p.length == 1) {
result.put(p[0], null);
} else {
throw new IllegalArgumentException();
}
}
return result;
}
} for (Entry<String, String> entry : QueryUtil.parseUriQuery(coapRequest.options().getUriQuery())
.entrySet()) {
... ..
} |
There is release v6.12.0 that contains implementation for this ticket, can we close it? |
Tested with v6.12.0, my integrations tests pass now without my "HACK" ✔️ Thx for adding this 🙏 |
coapRequest.options().getUriQueryMap()
seems to only support Option in the form of a "key=value" pair.It should also support more simple form like "key" without value.
(See more detailed at : #27 (comment))
The text was updated successfully, but these errors were encountered: