swifter
swifter copied to clipboard
Could not load image in html?
let httpServer = demoServer(Bundle.main.resourcePath!)
httpServer["/:path"] = shareFilesFromDirectory(Bundle.main.path(forResource: "Web", ofType: nil)!)
let port = 9080
do {
try httpServer.start(in_port_t(port))
} catch {
printLog("error: \(error)")
return
}
let myRequest = URLRequest(url: URL(string: "http://localhost:\(port)/index.html")!)
self.webView.load(myRequest)
status code is 404 in existing project, but works in new project. why??
Originally posted by @YiYiZheng in https://github.com/httpswift/swifter/issues/206#issuecomment-482788530
Solved by replace
let httpServer = demoServer(Bundle.main.resourcePath!)
with
let httpServer = HttpServer()
@YiYiZheng Hi did you get any solution of this?
jpg images is working fine problem with png images
That's interesting - I have the same issue here. JPG images are working fine, all PNG images won't be shown.
I met the same issure.png not show