더북(TheBook)

curl로 웹 요청을 전송한다.

명령 프롬프트

$ curl http://localhost:8080/users/1

retrieve user 1

 

$ curl http://localhost:8080/users/1/addresses/2

retrieve user 1's address 2

 

$ curl http://localhost:8080/users -d name=jaehue

map[name:jaehue]

 

$ curl http://localhost:8080/users -d {\"name\":\"jaehue\"}

map[{"name":"jaehue"}:]

 

$ curl http://127.0.0.1:8080/public/index.html

<html>

<body>

Hello World

</body>

</html>

 

$ curl http://localhost:8080/users/0

Internal Server Error

웹 서버 로그를 확인한다.

명령 프롬프트

$ ./app

2015/09/27 17:50:22 [GET] "/users/1" 35.762?s

2015/09/27 17:50:24 [GET] "/users/1/addresses/2" 38.198?s

2015/09/27 17:50:49 [POST] "/users" 59.136?s

2015/09/27 17:50:58 [POST] "/users" 72.771?s

2015/09/27 17:51:09 [GET] "/public/index.html" 4.155953ms

2015/09/27 17:51:14 panic: id is zero

2015/09/27 17:51:14 [GET] "/users/0" 66.75?s

신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.