201 response code

This commit is contained in:
Niccolo Borgioli 2024-05-25 12:12:32 +02:00
parent c435784983
commit c3321560bf
No known key found for this signature in database
GPG Key ID: 4897ACD13A65977C
2 changed files with 2 additions and 1 deletions

View File

@ -33,6 +33,7 @@ var (
BadRequest = HttpCode{Code: 400, Message: "Bad Response"}
NotFound = HttpCode{Code: 404, Message: "Not Found"}
OK = HttpCode{Code: 200, Message: "OK"}
Created = HttpCode{Code: 201, Message: "Created"}
)
type Response struct {

View File

@ -142,7 +142,7 @@ func main() {
method: "POST",
handler: func(req Request, matches []string) Response {
writeFile(matches[1], []byte(req.Body))
return Response{Version: req.Version, Code: OK}
return Response{Version: req.Version, Code: Created}
},
},
},