| 383 | } |
| 384 | |
| 385 | OsmOAuth::Response OsmOAuth::DirectRequest(string const & method, bool api) const |
| 386 | { |
| 387 | string const url = api ? m_apiUrl + kApiVersion + method : m_baseUrl + method; |
| 388 | HttpClient request(url); |
| 389 | if (!request.RunHttpRequest()) |
| 390 | MYTHROW(NetworkError, ("DirectRequest Network error while connecting to", url)); |
| 391 | if (request.WasRedirected()) |
| 392 | MYTHROW(UnexpectedRedirect, ("Redirected to", request.UrlReceived(), "from", url)); |
| 393 | |
| 394 | return {request.ErrorCode(), request.ServerResponse()}; |
| 395 | } |
| 396 | |
| 397 | string DebugPrint(OsmOAuth::Response const & code) |
| 398 | { |