You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of explicitly stating return respond().json(object); or return respond().xml(object); it should be possible to just state the object to be returned, and then base the response type on requested 'Accept' header.
This, of course, is not trivial, as we need to handle the possibility that the requested could be html.
Should the object somehow be translated into a reserved keyword for the template engine, like StringTemplate uses it?
Or should the keyword be based on the objects class name and thus possibly break the reusability of the template?
Setting the html issue aside, a proposed return signature could be: return respond(object); or return respond().accept(object); or return respond().asRequested(object);
If one after all still keeps the html issue in mind, the return signature could also be with an optional keyword specifier, like return respond().asRequested("person", object);
The text was updated successfully, but these errors were encountered:
Instead of explicitly stating
return respond().json(object);
orreturn respond().xml(object);
it should be possible to just state the object to be returned, and then base the response type on requested 'Accept' header.This, of course, is not trivial, as we need to handle the possibility that the requested could be
html
.Should the object somehow be translated into a reserved keyword for the template engine, like StringTemplate uses
it
?Or should the keyword be based on the objects class name and thus possibly break the reusability of the template?
Setting the
html
issue aside, a proposed return signature could be:return respond(object);
orreturn respond().accept(object);
orreturn respond().asRequested(object);
If one after all still keeps the
html
issue in mind, the return signature could also be with an optional keyword specifier, likereturn respond().asRequested("person", object);
The text was updated successfully, but these errors were encountered: