| 12 | HttpClient httpClient; |
| 13 | |
| 14 | int onDownload(HttpConnection& connection, bool success) |
| 15 | { |
| 16 | auto& request = *connection.getRequest(); |
| 17 | auto& response = *connection.getResponse(); |
| 18 | |
| 19 | Serial << endl << _F("=========[ URL: ") << request.uri << _F(" ]============") << endl; |
| 20 | Serial << _F("RemoteIP: ") << connection.getRemoteIp() << endl; |
| 21 | Serial << _F("Got response code: ") << response.code << " " << toString(response.code) << endl; |
| 22 | Serial << _F("Success: ") << success << " " << (success ? "OK" : "FAIL") << endl; |
| 23 | |
| 24 | if(request.method != HTTP_HEAD) { |
| 25 | Serial.print(_F("Got content: ")); |
| 26 | auto stream = response.stream; |
| 27 | if(stream == nullptr || stream->available() == 0) { |
| 28 | Serial.println(_F("EMPTY!")); |
| 29 | } else { |
| 30 | Serial.copyFrom(stream); |
| 31 | Serial.println(); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | auto ssl = connection.getSsl(); |
| 36 | if(ssl != nullptr) { |
| 37 | ssl->printTo(Serial); |
| 38 | } |
| 39 | |
| 40 | return 0; // return 0 on success in your callbacks |
| 41 | } |
| 42 | |
| 43 | void sslRequestInit(Ssl::Session& session, HttpRequest& request) |
| 44 | { |
nothing calls this directly
no test coverage detected