Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Fix API response for key creation.
kishorenc59131d1333ff
diff --git a/src/auth_manager.cpp b/src/auth_manager.cppindex 9374cf6b..1f985773 100644--- a/src/auth_manager.cpp+++ b/src/auth_manager.cpp@@ -126,9 +126,10 @@ bool AuthManager::authenticate(const std::string& req_api_key, const std::stringconst std::string& collection, std::map<std::string, std::string> & params) {if(req_api_key.size() > KEY_LEN) {- // scoped API key+ // scoped API key: validate and if valid, extract paramsOption<std::string> params_op = params_from_scoped_key(req_api_key, action, collection);if(!params_op.ok()) {+ // authentication failedreturn false;}diff --git a/src/core_api.cpp b/src/core_api.cppindex 8a9175ca..2c6d8bcd 100644--- a/src/core_api.cpp+++ b/src/core_api.cpp@@ -880,6 +880,8 @@ bool get_keys(http_req &req, http_res &res) {for(const auto & key: keys_op.get()) {nlohmann::json key_obj = key.to_json();+ key_obj["value_prefix"] = key_obj["value"];+ key_obj.erase("value");res_json["keys"].push_back(key_obj);}@@ -923,7 +925,7 @@ bool post_create_key(http_req &req, http_res &res) {return false;}- res.set(201, api_key_op.get().to_json().dump());+ res.set_201(api_key_op.get().to_json().dump());return true;}@@ -941,8 +943,11 @@ bool get_key(http_req &req, http_res &res) {return false;}- nlohmann::json res_json = key_op.get().to_json();- res.set_200(res_json.dump());+ nlohmann::json key_obj = key_op.get().to_json();+ key_obj["value_prefix"] = key_obj["value"];+ key_obj.erase("value");++ res.set_200(key_obj.dump());return true;}