How to get value computed in serverLogic method to header (method is returning object for body)

hi,
I am generating value in serverLogic method that is used there and I would like to also pass this valued into header. method returns object that will be turned to body (as json).
what is the best way to get that value (string) into response header string?

thank you.
regards,
peter

If I understand your problem correctly, I think what you are looking for is using a header output.
For example:

val e = endpoint.out(jsonBody[Data]).out(header[String]("X-My-Header"))

The server logic for such endpoint will have to provide a (Data, String) pair:

e.serverLogicSuccess(_ => _ => Future.successful(Data(...), "header value"))

I think that will do it.
thank you @adamw
regards,
peter