mirror of
https://github.com/cupcakearmy/codecrafters-http-server-go.git
synced 2024-12-22 08:06:27 +00:00
files 404
This commit is contained in:
parent
d7ac2a2a57
commit
8de565cb41
@ -148,8 +148,14 @@ func handleConnection(conn net.Conn) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
filename := filepath.Join(dir, matches[1])
|
||||
|
||||
// _, err:=os.Stat(filename)
|
||||
// fmt.Println(file)
|
||||
file, err := os.ReadFile(filename)
|
||||
if os.IsNotExist(err) {
|
||||
Respond(conn, Response{Version: request.Version, Code: NotFound})
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user