MCPcopy Create free account
hub / github.com/defold/defold / HttpWriteHeaders

Method HttpWriteHeaders

engine/dlib/src/test/test_httpclient.cpp:123–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121 }
122
123 static dmHttpClient::Result HttpWriteHeaders(dmHttpClient::HResponse response, void* user_data)
124 {
125 dmHttpClientTest* self = (dmHttpClientTest*) user_data;
126 char scale[128];
127 dmSnPrintf(scale, sizeof(scale), "%d", self->m_XScale);
128 self->m_Headers["X-Scale"] = std::string(scale);
129
130 // Let's use the m_Headers for writing as well.
131 std::map<std::string, std::string>::iterator it;
132 for (it = self->m_Headers.begin(); it != self->m_Headers.end(); it++)
133 {
134 dmHttpClient::Result result = dmHttpClient::WriteHeader(response, it->first.c_str(), it->second.c_str());
135 if (result != dmHttpClient::RESULT_OK)
136 {
137 dmLogError("Failed to write header '%s=%s'", it->first.c_str(), it->second.c_str());
138 return result;
139 }
140 }
141
142 self->m_Headers.clear(); // Prepare for receiving
143 return dmHttpClient::RESULT_OK;
144 }
145
146 dmHttpClient::Result HttpGet(const char* url)
147 {

Callers

nothing calls this directly

Calls 5

dmSnPrintfFunction · 0.85
WriteHeaderFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected