Mercurial > hg > orthanc
diff OrthancServer/Sources/LuaScripting.cpp @ 4605:c8f444e8556d
new function in the plugin SDK: OrthancPluginCallRestApi()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 Mar 2021 16:34:02 +0200 |
parents | b4c58795f3a8 |
children | d01702fb29a9 |
line wrap: on
line diff
--- a/OrthancServer/Sources/LuaScripting.cpp Wed Mar 17 15:48:31 2021 +0100 +++ b/OrthancServer/Sources/LuaScripting.cpp Tue Mar 30 16:34:02 2021 +0200 @@ -405,8 +405,8 @@ try { std::string result; - if (IHttpHandler::SimpleGet(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), - RequestOrigin_Lua, uri, headers)) + if (IHttpHandler::SimpleGet(result, NULL, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), + RequestOrigin_Lua, uri, headers) == HttpStatus_200_Ok) { lua_pushlstring(state, result.c_str(), result.size()); return 1; @@ -458,10 +458,12 @@ { std::string result; if (isPost ? - IHttpHandler::SimplePost(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), - RequestOrigin_Lua, uri, bodyData, bodySize, headers) : - IHttpHandler::SimplePut(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), - RequestOrigin_Lua, uri, bodyData, bodySize, headers)) + IHttpHandler::SimplePost(result, NULL, + serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), + RequestOrigin_Lua, uri, bodyData, bodySize, headers) == HttpStatus_200_Ok : + IHttpHandler::SimplePut(result, NULL, + serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), + RequestOrigin_Lua, uri, bodyData, bodySize, headers) == HttpStatus_200_Ok) { lua_pushlstring(state, result.c_str(), result.size()); return 1; @@ -522,8 +524,8 @@ try { - if (IHttpHandler::SimpleDelete(serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), - RequestOrigin_Lua, uri, headers)) + if (IHttpHandler::SimpleDelete(NULL, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), + RequestOrigin_Lua, uri, headers) == HttpStatus_200_Ok) { lua_pushboolean(state, 1); return 1;