GetPostPath Ongoing
authorFulup Ar Foll <fulup@iot.bzh>
Tue, 26 Jan 2016 08:16:56 +0000 (09:16 +0100)
committerFulup Ar Foll <fulup@iot.bzh>
Tue, 26 Jan 2016 08:16:56 +0000 (09:16 +0100)
include/proto-def.h
plugins/samples/SamplePost.c
src/helper-api.c

index 0f5ca04..65f3466 100644 (file)
@@ -26,6 +26,7 @@ PUBLIC int getQueryAll(AFB_request * request, char *query, size_t len);
 PUBLIC AFB_PostHandle* getPostHandle (AFB_request *request);
 PUBLIC json_object* getPostFile (AFB_request *request, AFB_PostItem *item, char* destination) ;
 PUBLIC AFB_PostCtx* getPostContext (AFB_request *request);
+PUBLIC char* getPostPath (AFB_request *request);
 
 // rest-api
 PUBLIC void endPostRequest(AFB_PostHandle *posthandle); 
index 13e1ad6..9828349 100644 (file)
@@ -53,7 +53,7 @@ STATIC json_object* UploadAppli (AFB_request *request, AFB_PostItem *item) {
             // Do something intelligent here to install application
             
             postFileCtx->errcode = MHD_HTTP_OK;   // or error is something went wrong;   
-            postFileCtx->jresp   = jsonNewMessage(AFB_SUCCESS,"UploadFile Post Appli done");
+            postFileCtx->jresp   = jsonNewMessage(AFB_SUCCESS,"UploadFile Post Appli=%s done", getPostPath (request));
         }
     }
     
index a166027..1253997 100644 (file)
@@ -93,6 +93,18 @@ PUBLIC AFB_PostCtx* getPostContext (AFB_request *request) {
     return ((AFB_PostCtx*) postHandle->ctx);
 }
 
+PUBLIC char* getPostPath (AFB_request *request) {
+    AFB_PostHandle *postHandle = getPostHandle(request);
+    AFB_PostCtx *postFileCtx;
+    
+    if (postHandle == NULL) return NULL;
+    
+    postFileCtx = (AFB_PostCtx*) postHandle->ctx;
+    if (postFileCtx == NULL) return NULL;
+  
+    return (postFileCtx->path);
+}
+
 PUBLIC json_object* getPostFile (AFB_request *request, AFB_PostItem *item, char* destination) {
 
     AFB_PostHandle *postHandle = getPostHandle(request);