package test;

import static io.restassured.http.ContentType.JSON;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import org.json.simple.JSONObject;

import io.restassured.RestAssured;
import io.restassured.config.RestAssuredConfig;
import io.restassured.config.SSLConfig;
import io.restassured.http.Header;
import io.restassured.http.Headers;
import io.restassured.response.Response;
import io.restassured.path.json.JsonPath;

public class RequestDataUtils3 {

	//发送post请求前的准备
	private static RestAssured getRMEnv() {
		RestAssured	ra = new RestAssured();
			ra.config = RestAssuredConfig.newConfig().sslConfig(
					SSLConfig.sslConfig().allowAllHostnames());
//			ra.baseURI = "http://ut1.zuul.pub.puhuifinance.com";
//				ra.port = 8765;
//			ra.basePath = "/bestbuy-app-server-cloud-server/api";
		return ra;
	}
	


	//发送post请求返回整个响应结果
	public static Response getPostResponse() {
		RequestDataUtils3 rdu=new RequestDataUtils3();
		Response re=null;                                                                                                        //{}                
		String url="http://beta.alitest.eoffcn.com/admin/customer/getList?page=1&size=10&username=YS自动化测试&phone=13910960649&:;\\|-+)(*~`.?^%$#@{[]><,card_no=qty50636&status=1";
//		String url="http://beta.alitest.eoffcn.com/admin/customer/getList?page=1&size=10&username=YS自动化测试&phone=13910960649&':;\\|-+)(*~`{}[]><,.?^%$#@!card_no=qty50636&status=1";
		
		Map<String,String> m=new HashMap<String,String>();
		m.put("user_name", "ws63417");
		m.put("password", "ws63417");
		m.put("code", "7bcdc063c9ed80c9f9fee83f1101aaed");
		try{
//			File filen=new File("out/3.jpg");
			re=rdu.getRMEnv().given()
//					.header("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtYWMiOiIxNDk5NDMwNzQwNzQzIiwidXNlcklkIjoyMjQxMCwic3ViIjoiMTU4MTEwMDM0MzEiLCJpc3MiOiJybS1hcHAtc2VydmVyIiwiaWF0IjoxNTAwMzY5MDE4fQ.nixejoF9AJCnBnj7JUkP9kcROWW3qnpP_yKUydJ0i-U")
//					.multiPart("file", filen)
//					.queryParam("orderId",map.get("orderId")+"&photoType="+map.get("photoType")+"&photoLocation="+map.get("photoLocation"))
//					.pathParam("photoType",map.get("photoType"))
//					.pathParam("photoLocation",map.get("photoLocation"))
					.cookie("PHPSESSID","7nm2u0efp5leta3quif37dm6r4")
					.get(url)
			        .thenReturn();
			
//			File filen=new File("out/"+filename);
//			re=rdu.getRMEnv(tem).given().header("Authorization", ZY.ZY_Token.get("token")==null? "":ZY.ZY_Token.get("token"))
//					.when().multiPart("file", filen)
//					.params(map)
//					.post(serviceURL).andReturn();
		}catch(Exception e){
			System.out.println(e.getMessage());
//			re=rdu.getRMEnv(tem).given().header("Authorization", ZY.ZY_Token.get("token")==null? "":ZY.ZY_Token.get("token"))
//					.when()
//					.params(map)
//					.post(serviceURL).andReturn();
		}
		System.out.println(re.asString());
		return null;
	}
	public static void main(String[] args) throws Exception {

		getPostResponse();
		
	}

}
