Skip to content

Commit 9f6053a

Browse files
committed
refs #141 for 0.4.x
1 parent 87c9352 commit 9f6053a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Examples/macOS/AppDelegate.swift

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
1111

1212
XCGLogger.defaultInstance().xcodeColorsEnabled = true
1313
XCGLogger.defaultInstance().setup(
14-
.Info,
15-
showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: nil, fileLogLevel: nil)
14+
.Verbose,
15+
showThreadName: true,
16+
showLogLevel: true,
17+
showFileNames: true,
18+
showLineNumbers: true,
19+
writeToFile: nil,
20+
fileLogLevel: nil
21+
)
1622

1723
let viewController:LiveViewController = LiveViewController()
1824
viewController.title = "lf - lIVE fRAMEWORK"

Sources/HTTP/HTTPService.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ public class HTTPService: NetService {
191191
func get(request:HTTPRequest, client:NetClient) {
192192
logger.verbose("\(request)")
193193
var response:HTTPResponse = HTTPResponse()
194+
195+
response.headerFields["Access-Control-Expose-Headers"] = "*"
196+
response.headerFields["Access-Control-Allow-Headers"] = "*"
197+
response.headerFields["Access-Control-Allow-Methods"] = "GET,HEAD,OPTIONS"
198+
response.headerFields["Access-Control-Allow-Origin"] = "*"
194199
response.headerFields["Connection"] = "close"
195200

196201
defer {
@@ -224,7 +229,6 @@ public class HTTPService: NetService {
224229
return
225230
}
226231
response.statusCode = HTTPStatusCode.NotFound.description
227-
response.headerFields["Connection"] = "close"
228232
client.doOutput(bytes: response.bytes)
229233
}
230234
}

0 commit comments

Comments
 (0)