Mercurial > hg > orthanc
diff Core/Lua/LuaContext.cpp @ 2724:c8d369400ae1 jobs
fix issue #77
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 12 Jul 2018 15:54:37 +0200 |
parents | 878b59270859 |
children | d924f9bb61cc |
line wrap: on
line diff
--- a/Core/Lua/LuaContext.cpp Thu Jul 12 15:11:42 2018 +0200 +++ b/Core/Lua/LuaContext.cpp Thu Jul 12 15:54:37 2018 +0200 @@ -287,7 +287,17 @@ if (nArgs >= 2 && !lua_isnil(state, 2)) { - that.httpClient_.SetBody(lua_tostring(state, 2)); + size_t bodySize = 0; + const char* bodyData = lua_tolstring(state, 2, &bodySize); + + if (bodySize == 0) + { + that.httpClient_.GetBody().clear(); + } + else + { + that.httpClient_.GetBody().assign(bodyData, bodySize); + } } else {