Added /timeout route
This commit is contained in:
parent
8936f7867f
commit
7efb4d5cde
14
app.py
14
app.py
|
@ -3,6 +3,7 @@ import logging
|
|||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
import requests
|
||||
from flask import Flask, request, Response, render_template, jsonify
|
||||
|
@ -161,6 +162,19 @@ def request_view():
|
|||
)
|
||||
|
||||
|
||||
@app.route("/timeout", methods=["GET"])
|
||||
def timeout_view():
|
||||
"""
|
||||
Forces a slow response from the request
|
||||
|
||||
Usage:
|
||||
/timeout?duration=301 (in seconds)
|
||||
"""
|
||||
duration = int(request.args.get("duration", 300))
|
||||
time.sleep(duration)
|
||||
return jsonify({"duration": duration})
|
||||
|
||||
|
||||
@app.route("/curl", methods=["POST"])
|
||||
def curl_view():
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue