diff options
author | Vinicius Costa Gomes <vinicius.gomes@intel.com> | 2017-01-17 16:17:07 -0800 |
---|---|---|
committer | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2017-01-20 16:23:19 +0200 |
commit | 6f578676547922a923cc34e5fb707453fd8af290 (patch) | |
tree | 14fa85e557787b84bb7f2e78d737f2cd107c31ba | |
parent | e44dfffba28f3e84ecad793ece2b36e60fcc96dc (diff) |
samples/zoap_server: Include a path for the "created" resource
The CoAP test suite expects a specific path included in the
Location-Path option in the response.
Change-Id: Ib7616f9ad318fa93dc862f686429edb5084306e3
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
-rw-r--r-- | samples/net/zoap_server/src/zoap-server.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/samples/net/zoap_server/src/zoap-server.c b/samples/net/zoap_server/src/zoap-server.c index dc99aa925..423557657 100644 --- a/samples/net/zoap_server/src/zoap-server.c +++ b/samples/net/zoap_server/src/zoap-server.c @@ -164,6 +164,11 @@ static int test_post(struct zoap_resource *resource, struct zoap_packet *request, const struct sockaddr *from) { + static const char * const location_path[] = { "location1", + "location2", + "location3", + NULL }; + const char * const *p; struct net_buf *buf, *frag; struct zoap_packet response; uint8_t *payload, code, type, tkl; @@ -216,6 +221,11 @@ static int test_post(struct zoap_resource *resource, zoap_header_set_id(&response, id); zoap_header_set_token(&response, token, tkl); + for (p = location_path; *p; p++) { + zoap_add_option(&response, ZOAP_OPTION_LOCATION_PATH, + *p, strlen(*p)); + } + return net_context_sendto(buf, from, sizeof(struct sockaddr_in6), NULL, 0, NULL, NULL); } |