Added COaP 13 support for query

Hi Robert, some small changes for supporting COaP 13 explicit query. Please check if you approve them to merge into your master or a new branch.