How to use cookie in scalatra when in scalatest?

14 views
Skip to first unread message

唐永刚

unread,
Dec 3, 2017, 10:14:57 PM12/3/17
to scalatra-user
Dear:

My all  AccountsServlet interface need session auth, so in my scalatest file I passed cookie varible(Map("cookie" -> "SESSION=3bc65dfd-f0c6-4b87-9f7b-ab1293e5436c")) to get function, like follow script:

class AccountServletTests extends ScalatraSuite with FunSuiteLike with DatabaseInit {
  addServlet(new AccountServlet(), "/*")

  override def beforeAll() = {
    configureDb()
    super.beforeAll
  }

  test("test /colleagues") {
      get("/colleagues", Seq.empty, Map("cookie" -> "SESSION=3bc65dfd-f0c6-4b87-9f7b-ab1293e5436c")) {
      status should equal(200)
      body should include("ddd")
    }

  }
}

But I still got unauthorized error , please help to tell me how to pass cookie from scalatest? thank you!
Reply all
Reply to author
Forward
0 new messages