rename endpoint for semantics + post -> get

This commit is contained in:
array-in-a-matrix 2024-07-03 01:45:36 -04:00
parent 94ef640810
commit 4dc897701d

View file

@ -74,21 +74,21 @@ routes:
#[
request parameters:
token - string - required
name - string - file name to download
token - string - required via header
name - string - file name via header
returns:
success - string/binary - file
fail - 403 - invalid token
fail - 404 - file doesn't exist
]#
post "/api/v1/getItemByName":
get "/api/v1/fileByName":
var user = newUser()
if not db.validToken(user, request.headers["Authorization"]):
resp Http403, "Invalid token."
var file = newFile()
try:
db.select(file, "File.name = ?", @"name")
db.select(file, "File.name = ?", request.headers["name"])
except NotFoundError:
resp Http404, "File does not exist"