usox/sharesta

Methods to retrieve values from RequestBody with specific type

usox opened this issue · 0 comments

usox commented

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.