• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-swift / 28234573387

26 Jun 2026 11:15AM UTC coverage: 80.991% (-0.02%) from 81.015%
28234573387

push

github

web-flow
chore: apply swift-format to entire codebase (#1038)

* chore: apply swift-format to entire codebase

Run `make format` across all Swift source files to bring the repo into
consistent formatting. No logic changes.

* ci: trust coverallsapp homebrew tap for Homebrew 6 compatibility

73 of 86 new or added lines in 15 files covered. (84.88%)

1 existing line in 1 file now uncovered.

7499 of 9259 relevant lines covered (80.99%)

36.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.41
/Sources/Helpers/HTTP/HTTPRequest.swift
1
//
2
//  HTTPRequest.swift
3
//
4
//
5
//  Created by Guilherme Souza on 23/04/24.
6
//
7

8
import Foundation
9
import HTTPTypes
10

11
#if canImport(FoundationNetworking)
12
  import FoundationNetworking
13
#endif
14

15
package struct HTTPRequest: Sendable {
16
  package var url: URL
17
  package var method: HTTPTypes.HTTPRequest.Method
18
  package var query: [URLQueryItem]
19
  package var headers: HTTPFields
20
  package var body: Data?
21
  package var timeoutInterval: TimeInterval
22

23
  package init(
24
    url: URL,
25
    method: HTTPTypes.HTTPRequest.Method,
26
    query: [URLQueryItem] = [],
27
    headers: HTTPFields = [:],
28
    body: Data? = nil,
29
    timeoutInterval: TimeInterval = 60
30
  ) {
334✔
31
    self.url = url
334✔
32
    self.method = method
334✔
33
    self.query = query
334✔
34
    self.headers = headers
334✔
35
    self.body = body
334✔
36
    self.timeoutInterval = timeoutInterval
334✔
37
  }
334✔
38

39
  package init?(
40
    urlString: String,
41
    method: HTTPTypes.HTTPRequest.Method,
42
    query: [URLQueryItem] = [],
43
    headers: HTTPFields = [:],
44
    body: Data? = nil,
45
    timeoutInterval: TimeInterval = 60
46
  ) {
×
47
    guard let url = URL(string: urlString) else { return nil }
×
NEW
48
    self.init(
×
NEW
49
      url: url, method: method, query: query, headers: headers, body: body,
×
NEW
50
      timeoutInterval: timeoutInterval)
×
UNCOV
51
  }
×
52

53
  package var urlRequest: URLRequest {
327✔
54
    var urlRequest = URLRequest(
327✔
55
      url: query.isEmpty ? url : url.appendingQueryItems(query), timeoutInterval: timeoutInterval)
327✔
56
    urlRequest.httpMethod = method.rawValue
327✔
57
    urlRequest.allHTTPHeaderFields = .init(headers.map { ($0.name.rawName, $0.value) }) { $1 }
1,079✔
58
    urlRequest.httpBody = body
327✔
59

327✔
60
    if urlRequest.httpBody != nil, urlRequest.value(forHTTPHeaderField: "Content-Type") == nil {
327✔
61
      urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
97✔
62
    }
97✔
63

327✔
64
    return urlRequest
327✔
65
  }
327✔
66
}
67

68
extension [URLQueryItem] {
69
  package mutating func appendOrUpdate(_ queryItem: URLQueryItem) {
99✔
70
    if let index = firstIndex(where: { $0.name == queryItem.name }) {
99✔
71
      self[index] = queryItem
×
72
    } else {
99✔
73
      self.append(queryItem)
99✔
74
    }
99✔
75
  }
99✔
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc