Tectu / malloy

A cross-platform C++20 library providing embeddable server & client components for HTTP and WebSocket.
BSD 3-Clause "New" or "Revised" License
66 stars 8 forks source link

[Enhancement] route_handler concept should include response return type #64

Closed 0x00002a closed 3 years ago

0x00002a commented 3 years ago

This is mostly for tracking

Currently the route_handler concept (which is used by router::add to constrain the callback type) only checks for invocable with the request and optionally the capture results. This is an incomplete definition as the type must also return a response<...> when invocked with said arguments.

The current lack of this additional requirement in the concept means that the user is presented with a rather obscure template error about void if their function does not have a return type (e.g. a default lambda) and which I spent a few minutes staring at before I realised the issue (bearing in mind I wrote that code in the first place :p).

Tectu commented 3 years ago

Yeah... I ran into that problem too 🙈 I'm all pro extending the concept.

Tectu commented 3 years ago

You wanna get this done for v0.1?

0x00002a commented 3 years ago

It shouldn't be too hard. I'll have a look tomorrow