File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,14 @@ public struct FileHTTPHandler: HTTPHandler {
5050
5151 static func makeContentType( for filename: String ) -> String {
5252 let pathExtension = ( filename. lowercased ( ) as NSString ) . pathExtension
53- return UTType ( filenameExtension: pathExtension) ? . preferredMIMEType ?? " application/octet-stream "
53+ switch pathExtension {
54+ case " wasm " :
55+ return " application/wasm "
56+ case " properties " :
57+ return " text/plain "
58+ default :
59+ return UTType ( filenameExtension: pathExtension) ? . preferredMIMEType ?? " application/octet-stream "
60+ }
5461 }
5562
5663 public func handleRequest( _ request: HTTPRequest ) async throws -> HTTPResponse {
Original file line number Diff line number Diff line change @@ -135,10 +135,10 @@ struct HTTPHandlerTests {
135135 FileHTTPHandler . makeContentType ( for: " fish.css " ) == " text/css "
136136 )
137137 #expect(
138- FileHTTPHandler . makeContentType ( for: " fish.js " ) == " application /javascript"
138+ FileHTTPHandler . makeContentType ( for: " fish.js " ) == " text /javascript"
139139 )
140140 #expect(
141- FileHTTPHandler . makeContentType ( for: " fish.javascript " ) == " application /javascript"
141+ FileHTTPHandler . makeContentType ( for: " fish.javascript " ) == " text /javascript"
142142 )
143143 #expect(
144144 FileHTTPHandler . makeContentType ( for: " fish.png " ) == " image/png "
@@ -162,10 +162,10 @@ struct HTTPHandlerTests {
162162 FileHTTPHandler . makeContentType ( for: " fish.mp4 " ) == " video/mp4 "
163163 )
164164 #expect(
165- FileHTTPHandler . makeContentType ( for: " fish.m4v " ) == " video/mp4 "
165+ FileHTTPHandler . makeContentType ( for: " fish.m4v " ) == " video/x-m4v "
166166 )
167167 #expect(
168- FileHTTPHandler . makeContentType ( for: " fish.ico " ) == " image/x- icon "
168+ FileHTTPHandler . makeContentType ( for: " fish.ico " ) == " image/vnd.microsoft. icon "
169169 )
170170 #expect(
171171 FileHTTPHandler . makeContentType ( for: " fish.wasm " ) == " application/wasm "
You can’t perform that action at this time.
0 commit comments