1
아래의 샘플 코드는 http 클라이언트에 있습니다.하지만 같은 코드를 Rest Assured에 쓰고 싶습니다. 나는 우리가뿐만 아니라 안심의 HTTP lib 디렉토리를 사용할 수있어,하지만 난 나머지에 갖고 싶어 나머지는 당신이 코드 아래 사용할 수 있습니다 피보험자를 들어url 인코딩 된 양식 엔티티를 설정하고 params를 나머지 양식 엔티티에 추가하는 방법은 무엇입니까?
HttpPost pst = new HttpPost(baseUrl, "j_spring_security_check"))
pst.setHeader("Content-Type", "application/x-www-form-urlencoded")
ArrayList<NameValuePair> postParam = new ArrayList<NameValuePair>()
postParam .add(new BasicNameValuePair("j_username",username))
postParam .add(new BasicNameValuePair("j_password",password))
UrlEncodedFormEntity formEntity23 = new UrlEncodedFormEntity(postParam)
pst.setEntity(formEntity23)
HttpResponse response = httpclient.execute(pst);