MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / convertHeadersToString

Function convertHeadersToString

CesiumAsync/src/SqliteCache.cpp:106–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104const std::string CLEAR_ALL_SQL = "DELETE FROM " + CACHE_TABLE;
105
106std::string convertHeadersToString(const HttpHeaders& headers) {
107 rapidjson::Document document;
108 rapidjson::Document::AllocatorType& allocator = document.GetAllocator();
109 rapidjson::Value root(rapidjson::kObjectType);
110 rapidjson::Value key(rapidjson::kStringType);
111 rapidjson::Value value(rapidjson::kStringType);
112 for (const std::pair<const std::string, std::string>& header : headers) {
113 key.SetString(header.first.c_str(), allocator);
114 value.SetString(header.second.c_str(), allocator);
115 root.AddMember(key, value, allocator);
116 }
117
118 rapidjson::StringBuffer buffer;
119 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
120 root.Accept(writer);
121 return buffer.GetString();
122}
123
124std::optional<HttpHeaders> convertStringToHeaders(
125 const std::string& serializedHeaders,

Callers 1

storeEntryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected