swifter icon indicating copy to clipboard operation
swifter copied to clipboard

Could not load image in html?

Open YiYiZheng opened this issue 5 years ago • 4 comments

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

YiYiZheng avatar Apr 13 '19 10:04 YiYiZheng

Solved by replace

let httpServer = demoServer(Bundle.main.resourcePath!)

with

let httpServer = HttpServer()

YiYiZheng avatar Apr 13 '19 12:04 YiYiZheng

@YiYiZheng Hi did you get any solution of this?

jpg images is working fine problem with png images

theRealGupta avatar Apr 24 '19 11:04 theRealGupta

That's interesting - I have the same issue here. JPG images are working fine, all PNG images won't be shown.

ChristianSteffens avatar May 25 '19 18:05 ChristianSteffens

I met the same issure.png not show

jerry1230 avatar Sep 27 '21 03:09 jerry1230