diff --git a/addon.py b/addon.py index ee7a238..259c595 100644 --- a/addon.py +++ b/addon.py @@ -16,7 +16,9 @@ with db as conn: conn.executescript(''' create table if not exists data ( id integer primary key, - url text not null + method text not null default "GET", + url text not null, + code integer default null ); ''') @@ -30,7 +32,11 @@ def response(flow: HTTPFlow) -> None: return uid: int = 0 with db as conn: - cur = conn.execute('insert into data (url) values (?) returning id', (url,)) + code = flow.response.status_code + cur = conn.execute( + 'insert into data (method, url, code) values (?, ?, ?) returning id', + (req.method, url, code if code != 200 else None), + ) uid = cur.fetchone()[0] path = os.path.join(storage, f'{uid}') if not os.path.exists(path):