我已经通过Postman和tests测试了我的restapi,并得到了响应,但是当我使用curl时,我得到了
***@*** MINGW64 ~
$ curl http://localhost:80/api/v1/stats
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 267 100 267 0 0 1197 0 --:--:-- --:--:-- --:--:-- 1197<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="http://localhost/api/v1/stats/">http://localhost/api/v1/stats/</a>. If not click the link.
邮递员筛选 enter image description here
守则:
app.py
app = Flask(__name__)
app.register_blueprint(attack_bp, url_prefix=URL_PATH + '/attack')
app.register_blueprint(stats_bp, url_prefix=URL_PATH + '/stats')
route.py
from flask import Blueprint
from controllers.Stats import index
stats_bp = Blueprint('stats_bp', __name__)
stats_bp.route('/', methods=['GET'])(index)
controller.py
from services import Services
s = Services()
def index():
return {"data": s.getStats()}
默认情况下
curl
不遵循重定向,必须使用-L
参数资料来源:https://everything.curl.dev/http/redirects#tell-curl-to-follow-redirects
相关问题 更多 >
编程相关推荐