FIX: Empty tab detection with default User-Agent header

This commit is contained in:
vesp 2026-01-12 22:43:46 +01:00
parent 84167d0ea4
commit dba19a211f
2 changed files with 8 additions and 2 deletions

View File

@ -49,7 +49,10 @@ class TabManager:
# Make a copy to avoid reference issues # Make a copy to avoid reference issues
# Create original for saved requests or loaded history items (anything with content) # Create original for saved requests or loaded history items (anything with content)
# Only skip for truly blank new requests # Only skip for truly blank new requests
has_content = bool(request.url or request.body or request.headers) # Consider headers empty if they only contain default headers
has_only_default_headers = request.headers == HttpRequest.default_headers()
has_non_default_headers = request.headers and not has_only_default_headers
has_content = bool(request.url or request.body or has_non_default_headers)
original_request = HttpRequest( original_request = HttpRequest(
method=request.method, method=request.method,
url=request.url, url=request.url,

View File

@ -301,10 +301,13 @@ class RosterWindow(Adw.ApplicationWindow):
# Check if it's empty # Check if it's empty
request = widget.get_request() request = widget.get_request()
# Consider headers empty if they're either empty or only contain default headers
from .models import HttpRequest
has_only_default_headers = request.headers == HttpRequest.default_headers()
is_empty = ( is_empty = (
not request.url.strip() and not request.url.strip() and
not request.body.strip() and not request.body.strip() and
not request.headers (not request.headers or has_only_default_headers)
) )
return is_empty return is_empty