Question: I had a function in AWS Lambda:

```
def test(pj: Pojo, context: Context): java.util.List[Document]

```

that was not initializing the `pj` with the input JSON values at all.

I found [another way](https://aws.amazon.com/blogs/compute/writing-aws-lambda-functions-in-scala/) of doing AWS Lambda in Scala like this:

```
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule

val scalaMapper = new ObjectMapper().registerModule(new DefaultScalaModule)

def test(input: InputStream, output: OutputStream): Unit = {
  val inputPojo = scalaMapper.readValue(input, classOf[Pojo])
  val answer: Seq[Document] = getTheRealAnswer(inputPojo)
  val jsonStr = "{ frustration: \"I wish my answer was JSON.\" }"
  output.write(jsonStr.getBytes("UTF-8"))
}

```

and that works, except what I really want to return as an answer is a JSON array of Documents. How should I go about that?

**Edit**: In my original posting, I wrote: *"[the first example] was returning the answer as an error 22. Basically AWS (I think) treated the JSON conversion of the List[Document] as a filename, JSON has plenty of colons, and the error 22 came from colons in filenames not being allowed. Weird."* That turned out to be an error in my invocation of the AWS Lambda Function from AWS CLI. I omitted the output filename in the command invocation, and returned JSON was interpreted by AWS CLI as a filename.

Answer: 
There is no way to send an Authentication header back and forth the way I was asking above. You would have to be explicitly be using `Basic Authorization`, which I was not.

The way I ended up doing it was making a cookie named `Authorization` where the body had the `JWT`. Cookies are automatically sent back to the server in the `HTTPRequest`, where I was able to strip it out in a custom filter.
Put JWT into cookie, this will protect it against theft by XSS attack