Преглед на файлове

LibWeb: Log failed Fetch responses when WEB_FETCH_DEBUG is enabled

We do the same for successful responses. Very useful for debugging
issues on live websites.
Timothy Flynn преди 1 година
родител
ревизия
7681772b9f
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  1. 2 0
      Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp

+ 2 - 0
Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp

@@ -1779,6 +1779,8 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> nonstandard_resource_load
         },
         [&realm, &vm, request, pending_response](auto& error, auto status_code, auto data, auto& response_headers) {
             dbgln_if(WEB_FETCH_DEBUG, "Fetch: ResourceLoader load for '{}' failed: {} (status {})", request->url(), error, status_code.value_or(0));
+            if constexpr (WEB_FETCH_DEBUG)
+                log_response(status_code, response_headers, data);
             auto response = Infrastructure::Response::create(vm);
             // FIXME: This is ugly, ResourceLoader should tell us.
             if (status_code.value_or(0) == 0) {