Closed jmolina4 closed 13 years ago
Just use the header
`Authorization`(BasicHttpCredentials(username = "bob", password = "123xyz"))
Please use the mailing list for any follow-up and all other questions regarding spray that you might have..
Cheers and happy spraying, Mathias
mathias@spray.cc http://www.spray.cc
On 04.11.2011, at 19:35, jamosa wrote:
Hello!
I'm trying to do a test in my project that uses a Rest Interface with authentication. To do the test, I define some interfaces and then I try to connect and it fails because I don't introduce user and password in httpRequest() . My code is the next:
val mediaType =
text/javascript
val expected = """ { "message":"It contains the collection of identifiers of the corpus in the system" } """
testService(HttpRequest(GET, "/corpus", headers = List(`Accept`(mediaType),`Authorization`(httpCredentials)))) { mapService }.response.content.as[String] must be(Right(pretty(render(parse(expected)))))
So, I know that I have to specify httpCredentials but I don't know how. If anyone can explain me how can I do it, I would be so grateful.
Thank you!
Reply to this email directly or view it on GitHub: https://github.com/spray/spray/issues/55
Thank you!
Hello!
I'm trying to do a test in my project that uses a Rest Interface with authentication. To do the test, I define some interfaces and then I try to connect and it fails because I don't introduce user and password in httpRequest() . My code is the next:
val mediaType =
text/javascript
val expected = """ { "message":"It contains the collection of identifiers of the corpus in the system" } """
So, I know that I have to specify httpCredentials but I don't know how. If anyone can explain me how can I do it, I would be so grateful.
Thank you!