■ curl 명령을 사용해 HTTP POST 요청을 처리하는 방법을 보여준다.
▶ 실행 명령
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[UBUNTU] curl -X 'POST' 'http://127.0.0.1:8000/todo' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{ "id" : 1, "item" : "First Todo is to finish this book!" }' [Windows] curl -X "POST" "http://127.0.0.1:8000/todo" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"id\" : 1, \"item\" : \"First Todo is to finish this book!\" }" [실행 결과] {"message":"Todo added successfully"} |