Finatra and Slick 3.1 returning success, failure, and value in response headers

115 Views Asked by At

I'm new to scala and I'm writing feature tests for a finatra and slick app, and I can't figure out why the response header is always sending back my resources as so:

{
 success: true,
 failure: false,
 value: {
   resources...
 }
}

Has anyone encountered this before? How can I get the response body to just return the resources (the value).

1

There are 1 best solutions below

2
On

I guess you are returning a value as this:

val myFuture = serviceUsingSlick.getSomething
reponse.ok.json(myFuture)

Use instead (for instance):

val myFuture = serviceUsingSlick.getSomething
myFuture.map {
  case Success(content) => reponse.ok.json(content)
  case Failure(t) => response.internalServerError(t.getMessage)
}