@@ -20,17 +20,8 @@ import NIOFoundationCompat
20
20
public struct HTTPError : Error , HTTPResponseError , Sendable {
21
21
/// status code for the error
22
22
public var status : HTTPResponse . Status
23
- /// internal representation of error headers without contentType
24
- private var _headers : HTTPFields
25
- /// headers
26
- public var headers : HTTPFields {
27
- get {
28
- return self . body != nil ? self . _headers + [ . contentType: " application/json; charset=utf-8 " ] : self . _headers
29
- }
30
- set {
31
- self . _headers = newValue
32
- }
33
- }
23
+ /// response headers
24
+ public var headers : HTTPFields
34
25
35
26
/// error message
36
27
public var body : String ?
@@ -40,7 +31,7 @@ public struct HTTPError: Error, HTTPResponseError, Sendable {
40
31
/// - status: HTTP status
41
32
public init ( _ status: HTTPResponse . Status ) {
42
33
self . status = status
43
- self . _headers = [ : ]
34
+ self . headers = [ : ]
44
35
self . body = nil
45
36
}
46
37
@@ -50,7 +41,7 @@ public struct HTTPError: Error, HTTPResponseError, Sendable {
50
41
/// - message: Associated message
51
42
public init ( _ status: HTTPResponse . Status , message: String ) {
52
43
self . status = status
53
- self . _headers = [ : ]
44
+ self . headers = [ : ]
54
45
self . body = message
55
46
}
56
47
@@ -61,7 +52,7 @@ public struct HTTPError: Error, HTTPResponseError, Sendable {
61
52
/// - message: Optional associated message
62
53
public init ( _ status: HTTPResponse . Status , headers: HTTPFields , message: String ? = nil ) {
63
54
self . status = status
64
- self . _headers = headers
55
+ self . headers = headers
65
56
self . body = message
66
57
}
67
58
0 commit comments