mirror of
https://github.com/cupcakearmy/codecrafters-http-server-go.git
synced 2024-11-09 18:34:18 +01:00
201 response code
This commit is contained in:
parent
c435784983
commit
c3321560bf
@ -33,6 +33,7 @@ var (
|
|||||||
BadRequest = HttpCode{Code: 400, Message: "Bad Response"}
|
BadRequest = HttpCode{Code: 400, Message: "Bad Response"}
|
||||||
NotFound = HttpCode{Code: 404, Message: "Not Found"}
|
NotFound = HttpCode{Code: 404, Message: "Not Found"}
|
||||||
OK = HttpCode{Code: 200, Message: "OK"}
|
OK = HttpCode{Code: 200, Message: "OK"}
|
||||||
|
Created = HttpCode{Code: 201, Message: "Created"}
|
||||||
)
|
)
|
||||||
|
|
||||||
type Response struct {
|
type Response struct {
|
||||||
|
@ -142,7 +142,7 @@ func main() {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
handler: func(req Request, matches []string) Response {
|
handler: func(req Request, matches []string) Response {
|
||||||
writeFile(matches[1], []byte(req.Body))
|
writeFile(matches[1], []byte(req.Body))
|
||||||
return Response{Version: req.Version, Code: OK}
|
return Response{Version: req.Version, Code: Created}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user