Open Semmarl opened 2 years ago
Hi, I havent been using GCDWebServer for a while, but I believe the "POST" handler method has to be added without the "default" handler specification. Please try following the README included in GCDWebServer "Advanced Example 2: Implementing Forms" as there is ax explicit example how to setup the POST method handler. It is written in Objective-C, but should be pretty easy to roughly translate it into Swift:
webserver.addHandler(forMethod: "POST", path: "/", request: GCDWebServerURLEncodedFormRequest.self, ....
please check if you are actually encoding a form or trying to accomplish something different. But again, I believe you are not supposed to handle any default POST requests without specifying a Path if I am not wrong. Try it out!
But please note that what you are reporting as an Issue is not a bug of GCDWebServer, and as written in the README file, you are supposed to use StackOverflow to get help for your own projects.
Get requests to server works and responsive but POST requests gives connection time out for iOS app.
[DEBUG] Did open connection on socket 11 [DEBUG] Did connect [DEBUG] Connection received 517 bytes on socket 11 [DEBUG] Did start background task [ERROR] No more data available on socket 11 [DEBUG] Connection aborted with status code 500 on socket 11 [DEBUG] Connection sent 116 bytes on socket 11 [DEBUG] Did close connection on socket 11 [VERBOSE] [192.168.1.110:8080] 192.168.1.106:53390 500 "(invalid request)" (517 | 116) [DEBUG] Did disconnect [DEBUG] Did end background task
Code:
`webServer.addDefaultHandler(forMethod: "GET", request: GCDWebServerRequest.self, processBlock: {request in
How can I fix this please?