I’m using: SWI-Prolog version 8.1.14-1-gd7dce07f8
In my server.pl, I define the following handler:
:- http_handler(assets(.), http_reply_from_files(myassets(.), []), [prefix, id(assets_handler)]).
When requesting a non-existent file, this throws an exception.
Question: Shouldn’t this handler return a status 404 if a file does not exist?
curl http://localhost:3000/assets/f
{
"code":500,
"message":"goal unexpectedly failed: user:http_reply_from_files(myassets('.'),[],[path_info(f),protocol(http),peer(ip(127,0,0,1)),pool(client('httpd@3000',http_unix_daemon:http_dispatch,<stream>(0x7f8a2a014020),<stream>(0x7f8a2a014200))),input(<stream>(0x7f8a2a014020)),method(get),request_uri('/assets/f'),path('/assets/f'),http_version(1-1),host(localhost),port(3000),user_agent('curl/7.54.0'),accept([media(_3436/_3438,[],1.0,[])])])"