重定向
重定向链、所有重定向状态码、仅限本地的 redirect-to,以及用于测试最大重定向次数的无限循环。每条链都以 /api/echo 结束,客户端可以看到它最终到达时的方法和请求体。
你的账号已解锁这些端点。在每个端点的页面上用 Try it 发送请求。
- GET
https://api.testingapis.com/api/redirect/{n}Starts a redirect chain of n hops that ends at /api/echoStarts a redirect chain ofnhops that ends at/api/echo. - GET
https://api.testingapis.com/api/redirect/absolute/{n}Starts a redirect chain of n hops that uses absolute URLsStarts a redirect chain ofnhops that uses absolute URLs. - GET
https://api.testingapis.com/api/redirect/loopStarts an infinite redirect loop between /loop and /loop/backStarts an infinite redirect loop between/loopand/loop/back. - GET
https://api.testingapis.com/api/redirect/loop/backContinues the infinite redirect loop back to /loopContinues the infinite redirect loop back to/loop. - GET
https://api.testingapis.com/api/redirect/relative/{n}Starts a redirect chain of n hops that uses relative referencesStarts a redirect chain ofnhops that uses relative references. - GETPOSTPUTPATCHDELETEHEAD
https://api.testingapis.com/api/redirect/status/{code}Redirects to /api/echo with the chosen redirect statusRedirects to/api/echowith the chosen redirect status. - GETPOSTPUTPATCHDELETEHEAD
https://api.testingapis.com/api/redirect/toRedirects to a local path on this serverRedirects to a local path on this server.
请求示例
Starts an infinite redirect loop between /loop and /loop/back. 完整参考和 Send 按钮(英文).
cURL
curl -X GET "https://api.testingapis.com/api/redirect/loop"响应 · 302 Found
{
"status": 302,
"statusText": "Found",
"location": "/api/redirect/loop/back",
"remaining": null,
"keepsMethod": false
}