From c102aaa266ac69a26d08ee6861da710283988e3b Mon Sep 17 00:00:00 2001 From: kean Date: Thu, 10 Oct 2024 21:37:04 -0400 Subject: [PATCH] Fix deep search for headers --- CHANGELOG.md | 1 + .../Search/Services/ConsoleSearchOperation.swift | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d683147e..c9bc40693 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Fix crash when exporting HAR file by @rounak in https://github.com/kean/Pulse/pull/299 - Fix concurrency issue in `StoreDetailsViewModel` by @ejensen in https://github.com/kean/Pulse/pull/302 - Update the deep search. It will now show all search scopes found and only one match per scope. You can tap on a match to see the scope with a prepopulated search query to see the remaining items. +- Fix an issue with deep search not working for request and response headers ## Pulse 5.1.1 diff --git a/Sources/PulseUI/Features/Search/Services/ConsoleSearchOperation.swift b/Sources/PulseUI/Features/Search/Services/ConsoleSearchOperation.swift index 40ed84b2a..acfc8451c 100644 --- a/Sources/PulseUI/Features/Search/Services/ConsoleSearchOperation.swift +++ b/Sources/PulseUI/Features/Search/Services/ConsoleSearchOperation.swift @@ -135,12 +135,22 @@ final class ConsoleSearchOperation { if let string = task.requestBody.flatMap(service.getBodyString) { occurrences += ConsoleSearchOperation.search(string, term, scope) } - case .originalRequestHeaders, .currentRequestHeaders, .responseHeaders: - break // Reserved + case .originalRequestHeaders: + if let headers = task.originalRequest?.httpHeaders { + occurrences += ConsoleSearchOperation.search(headers, term, scope) + } + case .currentRequestHeaders: + if let headers = task.currentRequest?.httpHeaders { + occurrences += ConsoleSearchOperation.search(headers, term, scope) + } case .responseBody: if let string = task.responseBody.flatMap(service.getBodyString) { occurrences += ConsoleSearchOperation.search(string, term, scope) } + case .responseHeaders: + if let headers = task.response?.httpHeaders { + occurrences += ConsoleSearchOperation.search(headers, term, scope) + } case .message, .metadata: break // Applies only to LoggerMessageEntity }