因爲 chrome 無法模擬發送 post 請求,因此之前找了一個叫 postman 的工具進行服務端的 post 請求測試,結果出現各種迷之 bug。後來才發現 python 做這種事情簡直不要太爽:
import requests
url = 'http://127.0.0.1:8000'
d = {'op': 'add', 'id': '1', 'text': 'test', 'password': 'xxxxxx'}
r = requests.post(url, data=d)
print(r.text)
print(r.status_code)