[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 08/277: support PATCH as well
From: |
gnunet |
Subject: |
[taler-merchant] 08/277: support PATCH as well |
Date: |
Sun, 05 Jul 2020 20:48:41 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit ed553c1bd7b3a26de30761fe85ad4e9639a06315
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Apr 17 20:33:24 2020 +0200
support PATCH as well
---
src/backend/taler-merchant-httpd.c | 10 ++++++----
src/backend/taler-merchant-httpd.h | 8 +++++---
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/backend/taler-merchant-httpd.c
b/src/backend/taler-merchant-httpd.c
index b1668e0..7ad0f85 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -777,7 +777,7 @@ url_handler (void *cls,
{
GNUNET_assert (NULL != hc->rh);
GNUNET_SCHEDULER_begin_async_scope (&hc->async_scope_id);
- if ( (hc->is_post) &&
+ if ( (hc->has_body) &&
(NULL == hc->json) )
{
int res;
@@ -983,9 +983,11 @@ url_handler (void *cls,
(json_int_t) TALER_EC_INSTANCE_UNKNOWN,
"error",
"merchant instance unknown");
- hc->is_post = (0 == strcasecmp (method,
- MHD_HTTP_METHOD_POST));
- if (hc->is_post)
+ hc->has_body = ( (0 == strcasecmp (method,
+ MHD_HTTP_METHOD_POST)) ||
+ (0 == strcasecmp (method,
+ MHD_HTTP_METHOD_PATCH)) );
+ if (hc->has_body)
{
/* FIXME: Maybe check for maximum upload size here
and refuse if it is too big? (Note: maximum upload
diff --git a/src/backend/taler-merchant-httpd.h
b/src/backend/taler-merchant-httpd.h
index 5f95778..1d5715d 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -285,7 +285,7 @@ struct TMH_HandlerContext
char *infix;
/**
- * JSON body that was uploaded, NULL if @e is_post is false.
+ * JSON body that was uploaded, NULL if @e has_body is false.
*/
json_t *json;
@@ -296,9 +296,11 @@ struct TMH_HandlerContext
void *json_parse_context;
/**
- * Set to true if this is an #MHD_HTTP_METHOD_POST request.
+ * Set to true if this is an #MHD_HTTP_METHOD_POST or #MHD_HTTP_METHOD_PATCH
request.
+ * (In principle #MHD_HTTP_METHOD_PUT may also belong, but we do not have
PUTs
+ * in the API today, so we do not test for PUT.)
*/
- bool is_post;
+ bool has_body;
};
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] branch master updated (9782a22 -> f829235), gnunet, 2020/07/05
- [taler-merchant] 01/277: first draft of new SQL logic, gnunet, 2020/07/05
- [taler-merchant] 03/277: complete first draft of new SQL schema, gnunet, 2020/07/05
- [taler-merchant] 02/277: rework merchant schema, gnunet, 2020/07/05
- [taler-merchant] 04/277: starting v1 protocol dispatching logic, gnunet, 2020/07/05
- [taler-merchant] 06/277: complete bootstrap logic in new design, gnunet, 2020/07/05
- [taler-merchant] 05/277: sketch instance loading, gnunet, 2020/07/05
- [taler-merchant] 07/277: implement GET /instances, gnunet, 2020/07/05
- [taler-merchant] 09/277: implement instances_get in library, gnunet, 2020/07/05
- [taler-merchant] 11/277: implement GET /instances/, gnunet, 2020/07/05
- [taler-merchant] 08/277: support PATCH as well,
gnunet <=
- [taler-merchant] 12/277: start on DELETE instance, gnunet, 2020/07/05
- [taler-merchant] 10/277: implement POST /instances, gnunet, 2020/07/05
- [taler-merchant] 14/277: implement PATCH, gnunet, 2020/07/05
- [taler-merchant] 13/277: implement DELETE /instances/$ID, gnunet, 2020/07/05
- [taler-merchant] 18/277: implement POST products/lock, gnunet, 2020/07/05
- [taler-merchant] 15/277: implement GET /products, gnunet, 2020/07/05
- [taler-merchant] 17/277: implement PATCH handlers, gnunet, 2020/07/05
- [taler-merchant] 19/277: backenddb implementation work, gnunet, 2020/07/05
- [taler-merchant] 23/277: specify remaining /instance API, gnunet, 2020/07/05
- [taler-merchant] 26/277: implement GET /products, gnunet, 2020/07/05