Skip to content

Commit 80dba3d

Browse files
Capitalize headers
1 parent e11ecfe commit 80dba3d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Sources/Alchemy/Filesystem/File.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ public struct File: Codable, ResponseConvertible {
3232
// MARK: - ResponseConvertible
3333

3434
public func response() async throws -> Response {
35-
Response(status: .ok, headers: ["content-disposition":"inline; filename=\"\(name)\""])
35+
Response(status: .ok, headers: ["Content-Disposition":"inline; filename=\"\(name)\""])
3636
.withBody(content, type: contentType, length: size)
3737
}
3838

3939
public func download() async throws -> Response {
40-
Response(status: .ok, headers: ["content-disposition":"attachment; filename=\"\(name)\""])
40+
Response(status: .ok, headers: ["Content-Disposition":"attachment; filename=\"\(name)\""])
4141
.withBody(content, type: contentType, length: size)
4242
}
4343

Sources/Alchemy/Utilities/Headers/HTTPHeaders+ContentInformation.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
extension HTTPHeaders {
22
public var contentType: ContentType? {
33
get {
4-
first(name: "content-type").map(ContentType.init)
4+
first(name: "Content-Type").map(ContentType.init)
55
}
66
set {
77
if let contentType = newValue {
8-
self.replaceOrAdd(name: "content-type", value: "\(contentType.string)")
8+
self.replaceOrAdd(name: "Content-Type", value: "\(contentType.string)")
99
} else {
10-
self.remove(name: "content-type")
10+
self.remove(name: "Content-Type")
1111
}
1212
}
1313
}
1414

1515
public var contentLength: Int? {
16-
get { first(name: "content-length").map { Int($0) } ?? nil }
16+
get { first(name: "Content-Length").map { Int($0) } ?? nil }
1717
set {
1818
if let contentLength = newValue {
19-
self.replaceOrAdd(name: "content-length", value: "\(contentLength)")
19+
self.replaceOrAdd(name: "Content-Length", value: "\(contentLength)")
2020
} else {
21-
self.remove(name: "content-length")
21+
self.remove(name: "Content-Length")
2222
}
2323
}
2424
}

0 commit comments

Comments
 (0)