chg: Add status code description

pull/81/head
Raphaël Vinot 2020-08-07 13:11:16 +02:00
parent c949320aa6
commit b85c2b85a3
2 changed files with 9 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import os
from pathlib import Path
from datetime import datetime, timedelta
import json
import http
from flask import Flask, render_template, request, send_file, redirect, url_for, Response, flash, jsonify
from flask_bootstrap import Bootstrap # type: ignore
@ -60,6 +61,13 @@ def sizeof_fmt(num, suffix='B'):
app.jinja_env.globals.update(sizeof_fmt=sizeof_fmt)
def http_status_description(code: int):
return http.client.responses[code]
app.jinja_env.globals.update(http_status_description=http_status_description)
@app.after_request
def after_request(response):
ua = request.headers.get('User-Agent')

View File

@ -111,7 +111,7 @@
<li class="list-group-item">
{# Details of the response #}
<p class="h4">Response <small>(Status code: {{ url['url_object'].response['status'] }})</small></p>
<p class="h4">Response <small>(Status code: <span title={{ http_status_description(url['url_object'].response['status']) }}>{{ url['url_object'].response['status'] }})</span></small></p>
{{ popup_icons(keys_response, url['url_object'], tree_uuid) }}
{% if url['url_object'].empty_response %}