| 480 | } |
| 481 | |
| 482 | static bool rest_block_part(const std::any& context, HTTPRequest* req, const std::string& uri_part) |
| 483 | { |
| 484 | try { |
| 485 | if (const auto opt_offset{ToIntegral<size_t>(req->GetQueryParameter("offset").value_or(""))}) { |
| 486 | if (const auto opt_size{ToIntegral<size_t>(req->GetQueryParameter("size").value_or(""))}) { |
| 487 | return rest_block(context, req, uri_part, |
| 488 | /*tx_verbosity=*/std::nullopt, |
| 489 | /*block_part=*/{{*opt_offset, *opt_size}}); |
| 490 | } else { |
| 491 | return RESTERR(req, HTTP_BAD_REQUEST, "Block part size missing or invalid"); |
| 492 | } |
| 493 | } else { |
| 494 | return RESTERR(req, HTTP_BAD_REQUEST, "Block part offset missing or invalid"); |
| 495 | } |
| 496 | } catch (const std::runtime_error& e) { |
| 497 | return RESTERR(req, HTTP_BAD_REQUEST, e.what()); |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | static bool rest_filter_header(const std::any& context, HTTPRequest* req, const std::string& uri_part) |
| 502 | { |
nothing calls this directly
no test coverage detected