| 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 | { |
nothing calls this directly
no test coverage detected