HEAD method doesn't seem to work
osfunapps opened this issue · comments
Oz commented
Hello,
I have this simple code to handle head requests:
func startServer(port: Int) -> Error? {
do {
if server.isRunning {
return nil
}
try server.start(port: port)
server.webSocketDelegate = self
server.route(.HEAD, "head", handleHeadRequest(request:))
return nil
} catch let error {
if error.localizedDescription == "Address already in use" {
return nil
}
return error
}
}
func handleHeadRequest(request: HTTPRequest) -> HTTPResponse {
return HTTPResponse(content: "Hello")
}
For some reason, I don't receive any requests from the server side.
Can you help me?
Rastko Šoškić commented
I am also having issue with HEAD route... in unit test when I issue HEAD http request towards Telegraph's HEAD route... e.g.
telegraph.route(.HEAD, regex: ".*") { request in HTTPResponse(.ok) }
Every HEAD request fails with error: "Network connection was lost" Every other HTTP method I put in that route (PUT, PATCH) works - only HEAD is failing
Yvo van Beek commented
This should be resolved in the latest commits