usox / sharesta

Sharesta (Strict HAck RESTful Apis) is a micro framework to build simple and easy to use rest-like applications - written in strict hack.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Methods to retrieve values from RequestBody with specific type

usox opened this issue · comments

Currently, the only way to retrieve request values from the request body is accessing getBody(): Map<string, mixed> within RequestBody. All values within this Map are mixed, therefor various type-checks within the routes/handlers are necessary to maintain strict typing which results in code duplications.
Maybe it would make sense to provide a bunch of methods which retrieve the values from the Map and cast them automatically, e.g. for scalars and traversables.