8000 fixed har export issue by abhimaanmadhav · Pull Request #319 · kean/Pulse · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fixed har export issue #319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
25 changes: 16 additions & 9 deletions Sources/PulseUI/Helpers/HARDocument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,7 @@ extension HARDocument {
cache = .init()
connection = "\(entity.orderedTransactions.first?.remotePort ?? .zero)"
pageref = pageId
request = .init(
cookies: [],
headers: entity.originalRequest?.headers.compactMap { ["name": $0.key, "value": $0.value] } ?? [],
httpVersion: "HTTP/2",
method: entity.httpMethod,
queryString: [],
url: entity.url
)

request = .init(entity)
response = .init(entity)

serverIPAddress = entity.orderedTransactions.first?.remoteAddress ?? ""
Expand Down Expand Up @@ -170,6 +162,21 @@ extension HARDocument.Entry {
let method: String?
let queryString: [[String: String]]
let url: String?
let postData: Content?

init(_ entity: NetworkTaskEntity?) {

bodySize = Int(entity?.requestBody?.size ?? -1);
cookies = []
headers = entity?.originalRequest?.headers.compactMap { ["name": $0.key, "value": $0.value] } ?? [];
httpVersion = "HTTP/2";
method = entity?.httpMethod;
queryString = [];
url = entity?.url;
postData = .init(entity?.requestBody);

}

}

struct Response: Encodable {
Expand Down
7 changes: 5 additions & 2 deletions Sources/PulseUI/Mocks/MockTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ extension MockTask {
private let mockLoginOriginalRequest = URLRequest(
url: "https://github.com/login?scopes=profile,repos",
method: "POST",
headers: ["Cache-Control": "no-cache"]
headers: ["Cache-Control": "no-cache"],
body: "{\"login\":\"example\",\"password\":\"example2\"}"
)

private let mockLoginCurrentRequest = mockLoginOriginalRequest.adding(headers: [
Expand Down Expand Up @@ -498,10 +499,12 @@ package let mockPDF = Data(base64Encoded: "JVBERi0xLjMNCiXi48/TDQoNCjEgMCBvYmoNC
// MARK: Helpers

private extension URLRequest {
init(url: String, method: String = "GET", headers: [String: String] = [:]) {
init(url: String, method: String = "GET", headers: [String: String] = [:],
body: String? = nil) {
self.init(url: URL(string: url)!)
self.httpMethod = method
self.allHTTPHeaderFields = headers
self.httpBody = body?.data(using: .utf8)
}

func adding(headers: [String: String]) -> Self {
Expand Down
Loading
0