Mercurial > hg > orthanc-stone
diff Platforms/Wasm/WasmWebService.cpp @ 418:c23df8b3433b
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 15 Nov 2018 18:32:48 +0100 |
parents | aee3d7941c9b |
children | 3a8bcc45c221 |
line wrap: on
line diff
--- a/Platforms/Wasm/WasmWebService.cpp Thu Nov 15 17:28:15 2018 +0100 +++ b/Platforms/Wasm/WasmWebService.cpp Thu Nov 15 18:32:48 2018 +0100 @@ -69,11 +69,6 @@ } } - void EMSCRIPTEN_KEEPALIVE WasmWebService_SetBaseUri(const char* baseUri) - { - OrthancStone::WasmWebService::GetInstance().SetBaseUri(baseUri); - } - #ifdef __cplusplus } #endif @@ -84,20 +79,6 @@ { MessageBroker* WasmWebService::broker_ = NULL; - void WasmWebService::SetBaseUri(const std::string baseUri) - { - // Make sure the base url ends with "/" - if (baseUri.empty() || - baseUri[baseUri.size() - 1] != '/') - { - baseUri_ = baseUri + "/"; - } - else - { - baseUri_ = baseUri; - } - } - void ToJsonString(std::string& output, const IWebService::HttpHeaders& headers) { Json::Value jsonHeaders; @@ -122,10 +103,9 @@ MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallable, unsigned int timeoutInSeconds) { - std::string uri = baseUri_ + relativeUri; std::string headersInJsonString; ToJsonString(headersInJsonString, headers); - WasmWebService_PostAsync(successCallable, failureCallable, uri.c_str(), headersInJsonString.c_str(), + WasmWebService_PostAsync(successCallable, failureCallable, relativeUri.c_str(), headersInJsonString.c_str(), body.c_str(), body.size(), payload, timeoutInSeconds); } @@ -136,10 +116,9 @@ MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallable, unsigned int timeoutInSeconds) { - std::string uri = baseUri_ + relativeUri; std::string headersInJsonString; ToJsonString(headersInJsonString, headers); - WasmWebService_DeleteAsync(successCallable, failureCallable, uri.c_str(), headersInJsonString.c_str(), + WasmWebService_DeleteAsync(successCallable, failureCallable, relativeUri.c_str(), headersInJsonString.c_str(), payload, timeoutInSeconds); } @@ -150,9 +129,9 @@ MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallable, unsigned int timeoutInSeconds) { - std::string uri = baseUri_ + relativeUri; std::string headersInJsonString; ToJsonString(headersInJsonString, headers); - WasmWebService_GetAsync(successCallable, failureCallable, uri.c_str(), headersInJsonString.c_str(), payload, timeoutInSeconds); + WasmWebService_GetAsync(successCallable, failureCallable, relativeUri.c_str(), + headersInJsonString.c_str(), payload, timeoutInSeconds); } }