fix(schema): revert 200->None replacement feature

go-sqlite3 used in server can not process NULLs
This commit is contained in:
DarkCat09 2024-07-02 19:35:41 +04:00
parent 74e6771fd3
commit 95f280663b
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3

View file

@ -18,7 +18,7 @@ with db as conn:
id integer primary key,
method text not null default "GET",
url text not null,
code integer default null
code integer not null default 200
);
''')
@ -35,7 +35,7 @@ def response(flow: HTTPFlow) -> None:
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),
(req.method, url, code),
)
uid = cur.fetchone()[0]
path = os.path.join(storage, f'{uid}')