envoy / Embassy

Super lightweight async HTTP server library in pure Swift runs in iOS / MacOS / Linux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Second request not receive json data

minwookH opened this issue · comments

I used

let loop = try! SelectorEventLoop(selector: try! KqueueSelector())
let router = Router()
let server = DefaultHTTPServer(eventLoop: loop, port: 9090, app: router.app)

router["/first"] = JSONResponse(
            ...
        ) { environ -> Any in
            let input = environ["swsgi.input"] as! SWSGIInput
            JSONReader.read(input) { json in
                 CODE A
           }
           ...
      }

router["/second"] = JSONResponse(
            ...
        ) { environ -> Any in
            let input = environ["swsgi.input"] as! SWSGIInput
            JSONReader.read(input) { json in
                CODE B
           }
           ...
      }

do {
       try server.start()
       loop.runForever()   
} catch {
       print("Unexpected error : \(error).")
}

First call "/first" api and Second call "/second" api from Safari browser.
It contains json data.
The first api call calls for CODE A
but The second call does not call for CODE B.
Chrome browser is not problem