I did the following steps : -
1) Installed TomCat
2) Installed Xampp
3) Copied the Retail App Test inside C:/ProgramFiles/ApacheSoftwareFoundation/Tomcat 6.0/webapps folder
4) In Xampp folder, opened Xampp-control.exe.
5) Started Apache and MySQL
6) Created a POJO class Session.Java
7) Created a Test Case as LoginRequest as below : -
public class LoginRequest {
@Test
public void test001() {
RestAssured.baseURI="http://localhost:8080/Retail_App_Rest/retail/admin/login";
RequestSpecification reqt=RestAssured.given();
Session s=new Session();
s.setUsername("sankalp.puranik@gmail.com");
s.setPassword("12345");
reqt.contentType(ContentType.JSON);
Response resp=reqt.body(s).post();
resp.prettyPrint();
}
Getting the following error on Console : -
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 403 No valid crumb was included in the request</title>
</head>
<body>
<h2>HTTP ERROR 403</h2>
<p>Problem accessing /Retail_App_Rest/retail/admin/login. Reason:
</p>
<pre> No valid crumb was included in the request</pre>
<hr/>
<a shape="rect" href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a>
<hr/>
</body>
</html>
Attaching Sessions.java POJO class as well as LoginRequest.Java
Thanks
Sankalp
Adding LoginRequest
Instructor
Abhinav Replied on 29/03/2019
Please share your project zip here, if still not resolved.