@@ -76,7 +76,8 @@ HTTPRequest::HTTPRequest(v8::Isolate* isolate, v8::Local<v8::Value> conf) {
7676 v8::HandleScope handle_scope (isolate);
7777 auto tmp = config->Get (context, NewV8Key (isolate, " url" )).FromMaybe (undefined);
7878 if (tmp->IsString ()) {
79- SetUrl (*v8::String::Utf8Value (isolate, tmp));
79+ url = *v8::String::Utf8Value (isolate, tmp);
80+ SetUrl (url);
8081 }
8182 }
8283 {
@@ -220,6 +221,10 @@ HTTPResponse HTTPRequest::GetResponse() {
220221 }
221222}
222223
224+ std::string HTTPRequest::GetUrl () const {
225+ return this ->url ;
226+ }
227+
223228size_t AsyncRequest::pool_size = 1 ;
224229size_t AsyncRequest::queue_cap = 1 ;
225230
@@ -229,10 +234,11 @@ bool AsyncRequest::Submit(std::shared_ptr<HTTPRequest> request) {
229234 return pool->Post ([request]() {
230235 auto response = request->GetResponse ();
231236 if (response.error ) {
232- Platform::logger (std::string (" async request failed: " ) + response.error .message + std::string (" \n " ));
237+ Platform::logger (std::string (" async request failed; url: " ) + request->GetUrl () +
238+ " , errMsg: " + response.error .message + std::string (" \n " ));
233239 } else if (response.status_code != 200 ) {
234- Platform::logger (std::string (" async request status: " ) + std::to_string (response.status_code ) +
235- std::string ( " body: " ) + response.text .substr (0 , 1024 ) + std::string (" \n " ));
240+ Platform::logger (std::string (" async request status: " ) + std::to_string (response.status_code ) + " , url: " +
241+ request-> GetUrl () + " , body: " + response.text .substr (0 , 1024 ) + std::string (" \n " ));
236242 }
237243 });
238244}
0 commit comments