mirror of
https://github.com/cupcakearmy/codecrafters-http-server-go.git
synced 2024-12-22 08:06:27 +00:00
add content type
This commit is contained in:
parent
77e886b8f9
commit
87aa98c68e
@ -113,7 +113,12 @@ func handleConnection(conn net.Conn) {
|
||||
re := regexp.MustCompile(`^/echo/([A-Za-z]+)$`)
|
||||
matches := re.FindStringSubmatch(request.Path)
|
||||
if len(matches) > 0 {
|
||||
Respond(conn, Response{Version: request.Version, Code: OK, Body: matches[1]})
|
||||
Respond(conn, Response{
|
||||
Version: request.Version,
|
||||
Code: OK,
|
||||
Body: matches[1],
|
||||
Headers: []Header{Header{Name: "Content-Type", Value: "text/plain"}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user