How do I return a different HTTP status code than the basic ones? (i.e 202 instead of 200)
You are able to gain more control over the HTTP headers (such as status codes) through the ServerServiceCall
. Utilizing that mechanism you can use the invokeWithHeaders
method, which responds with ResponseHeader
in addition to the Response
itself. You can then use this control of the ResponseHeader
to set the HTTP status as is best suited for your needs.
Related Articles
How to run some Lagom services instead of one or all
Currently, Lagom’s built-in tooling allows for running a single service via run or all of them via runAll. In some cases you may find it more convenient to run a specific subset of services. The simplest solution for this is to create ...
How to implement versioning in Lagom microservices?
Lagom doesn't provide any solution, plugin or feature that enables API versioning. However you can use the following to decide and pick what works best for you: When versioning you must keep in mind both the service endpoints and payloads and the ...
Does Lagom support multitenancy?
Our suggestion is to not go down this path. Multi-tenancy was very popular back in the time when people used to deploy one single application on a huge application server. In the era of cloud computing, it's much easier to have different deployments, ...
Can Lagom errors be handled using Play error handling?
No, the Play error handler is not invoked from Lagom, because the Lagom exception serializer intercepts it first. Any exception thrown by application code will be wrapped in a transport exception, serialized to json and a response is built from it. ...
Is it possible to bind path variables to a domain object in Lagom?
Yes, Lagom provides an interface called PathParamSerializer that can be used to convert a path parameter to another type. In fact, there are already many built-in path parameter serializers at your disposal. However, there are still a number of ...