comparison OrthancServer/Sources/LuaScripting.cpp @ 4329:9dc0e42f868b

moving static methods from HttpToolbox to IHttpHandler
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Nov 2020 13:46:49 +0100
parents 318c16cfccab
children d9473bd5ed43
comparison
equal deleted inserted replaced
4328:ce9284aebd40 4329:9dc0e42f868b
403 LuaContext::GetDictionaryArgument(headers, state, 3, true /* HTTP header key to lower case */); 403 LuaContext::GetDictionaryArgument(headers, state, 3, true /* HTTP header key to lower case */);
404 404
405 try 405 try
406 { 406 {
407 std::string result; 407 std::string result;
408 if (HttpToolbox::SimpleGet(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), 408 if (IHttpHandler::SimpleGet(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin),
409 RequestOrigin_Lua, uri, headers)) 409 RequestOrigin_Lua, uri, headers))
410 { 410 {
411 lua_pushlstring(state, result.c_str(), result.size()); 411 lua_pushlstring(state, result.c_str(), result.size());
412 return 1; 412 return 1;
413 } 413 }
414 } 414 }
456 456
457 try 457 try
458 { 458 {
459 std::string result; 459 std::string result;
460 if (isPost ? 460 if (isPost ?
461 HttpToolbox::SimplePost(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), 461 IHttpHandler::SimplePost(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin),
462 RequestOrigin_Lua, uri, bodyData, bodySize, headers) : 462 RequestOrigin_Lua, uri, bodyData, bodySize, headers) :
463 HttpToolbox::SimplePut(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), 463 IHttpHandler::SimplePut(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin),
464 RequestOrigin_Lua, uri, bodyData, bodySize, headers)) 464 RequestOrigin_Lua, uri, bodyData, bodySize, headers))
465 { 465 {
466 lua_pushlstring(state, result.c_str(), result.size()); 466 lua_pushlstring(state, result.c_str(), result.size());
467 return 1; 467 return 1;
468 } 468 }
469 } 469 }
520 std::map<std::string, std::string> headers; 520 std::map<std::string, std::string> headers;
521 LuaContext::GetDictionaryArgument(headers, state, 3, true /* HTTP header key to lower case */); 521 LuaContext::GetDictionaryArgument(headers, state, 3, true /* HTTP header key to lower case */);
522 522
523 try 523 try
524 { 524 {
525 if (HttpToolbox::SimpleDelete(serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), 525 if (IHttpHandler::SimpleDelete(serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin),
526 RequestOrigin_Lua, uri, headers)) 526 RequestOrigin_Lua, uri, headers))
527 { 527 {
528 lua_pushboolean(state, 1); 528 lua_pushboolean(state, 1);
529 return 1; 529 return 1;
530 } 530 }
531 } 531 }