* RESTCONF PUT/POST erroneously returned 200 OK. Instead restconf now returns:

* `201 Created` for created resources
  * `204 No Content` for replaced resources.
  * See [RESTCONF: HTTP return codes are not according to RFC 8040](https://github.com/clicon/clixon/issues/56)

* HTTP `Location:` fields added in RESTCONF POST replies
This commit is contained in:
Olof hagsand 2019-07-25 13:15:31 +02:00
parent 291f173505
commit c1bae276ff
27 changed files with 1734 additions and 1298 deletions

View file

@ -2,7 +2,7 @@
*
***** BEGIN LICENSE BLOCK *****
Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren
Copyright (C) 2009-2019 Olof Hagsand
This file is part of CLIXON.
@ -78,6 +78,8 @@
/* restconf */
#include "restconf_lib.h"
#include "restconf_methods.h"
#include "restconf_methods_post.h"
#include "restconf_methods_get.h"
#include "restconf_stream.h"
/* Command line options to be passed to getopt(3) */
@ -368,7 +370,7 @@ api_restconf(clicon_handle h,
retval = notfound(r);
goto done;
}
test(r, 1);
restconf_test(r, 1);
if (pn == 2){
retval = api_root(h, r);
@ -429,7 +431,7 @@ api_restconf(clicon_handle h,
goto done;
}
else if (strcmp(method, "test") == 0)
test(r, 0);
restconf_test(r, 0);
else
notfound(r);
ok: