[WIP]: 404 handling
This commit is contained in:
parent
c96300a2f4
commit
040776e671
@ -1,23 +1,23 @@
|
||||
: 1
|
||||
summary: Seafire Resources project repository
|
||||
summary: Seafire-Resources project repository
|
||||
|
||||
:
|
||||
role: prerequisite
|
||||
location: https://pkg.cppget.org/1/beta
|
||||
trust: 70:64:FE:E4:E0:F3:60:F1:B4:51:E1:FA:12:5C:E0:B3:DB:DF:96:33:39:B9:2E:E5:C2:68:63:4C:A6:47:39:43
|
||||
|
||||
#:
|
||||
#role: prerequisite
|
||||
#location: https://code.helloryan.se/code/libcode-seafire-common.git##HEAD
|
||||
#
|
||||
#:
|
||||
#role: prerequisite
|
||||
#location: https://code.helloryan.se/code/libcode-seafire-protocol.git##HEAD
|
||||
#
|
||||
#:
|
||||
#role: prerequisite
|
||||
#location: https://code.helloryan.se/code/libcode-seafire-server.git##HEAD
|
||||
#
|
||||
#:
|
||||
#role: prerequisite
|
||||
#location: https://code.helloryan.se/code/libcode-seafire-representation.git##HEAD
|
||||
:
|
||||
role: prerequisite
|
||||
location: https://code.helloryan.se/creatures/Seafire-Common.git##HEAD
|
||||
|
||||
:
|
||||
role: prerequisite
|
||||
location: https://code.helloryan.se/creatures/Seafire-Protocol.git##HEAD
|
||||
|
||||
:
|
||||
role: prerequisite
|
||||
location: https://code.helloryan.se/creatures/Seafire-Server.git##HEAD
|
||||
|
||||
:
|
||||
role: prerequisite
|
||||
location: https://code.helloryan.se/creatures/Seafire-Representation.git##HEAD
|
||||
|
@ -10,29 +10,9 @@ namespace seafire::resources
|
||||
get_kind_t kind)
|
||||
{
|
||||
auto rep = common::invoke(resource, req, &R::get);
|
||||
auto selected_rep = representation::select(rep, accepted_type);
|
||||
|
||||
auto select = [&]() -> decltype(rep)
|
||||
{
|
||||
if constexpr (representation::traits::is_optional_representation_v<decltype(rep)>) {
|
||||
if (!rep) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return representation::select(*rep, accepted_type);
|
||||
}
|
||||
else {
|
||||
return representation::select(rep, accepted_type);
|
||||
}
|
||||
};
|
||||
|
||||
auto selected_rep = select();
|
||||
|
||||
if (!selected_rep) {
|
||||
res.send(server::common_error_t::not_found);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_preconditions(req, res, *selected_rep))
|
||||
if (!check_preconditions(req, res, selected_rep))
|
||||
return;
|
||||
|
||||
namespace rfc7231 = protocol::rfc7231;
|
||||
@ -55,7 +35,7 @@ namespace seafire::resources
|
||||
status = 201;
|
||||
|
||||
bool const send_content = kind != get_kind_t::head;
|
||||
representation::send(req, res, status, *selected_rep, send_content);
|
||||
representation::send(req, res, status, selected_rep, send_content);
|
||||
}
|
||||
|
||||
} // namespace seafire::resources
|
||||
|
@ -46,10 +46,6 @@ namespace seafire::resources::traits
|
||||
representation::traits::is_representation_v<
|
||||
typename common::traits::function_traits<decltype(&R::get)>::return_type
|
||||
>
|
||||
||
|
||||
representation::traits::is_optional_representation_v<
|
||||
typename common::traits::function_traits<decltype(&R::get)>::return_type
|
||||
>
|
||||
> {
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user