Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Response should be coming not Null so that status code should be 200 not 400.


Code --


public static Response getRequest(String urlParameters, Map<string, string=""> headers) {
RequestSpecification spec = setCertification(); Response response = null; try {
LOGGER.info("URL : ()", EnvironmentPath.GET LIMITS TRANSACTION_PATH_URI + urlParameters); response = RestAssured.given().spec(spec).when().contentType(ContentType. JSON).headers(headers)
.get(EnvironmentPath.GET_LIMITS TRANSACTION_PATH URI + urlParameters).then().extract().response(); }
catch (Exception e) {
LOGGER.error("GET_REQUEST_NOT_PROCESSED- there was an exception raised while processing the request"); throw new DPMSException("GET_REQUEST_NOT_PROCESSED - there was an exception raised while processing the request
return response;

What I have tried:

I tried debugging but didn't know ... I'm new in this
Posted
Updated 13-Apr-22 0:30am

1 solution

To me, it seems like you are not closing your catch block and your function properly

Like what you have here...
public static Response getRequest(String urlParameters, Map<string, string=""> headers) {
RequestSpecification spec = setCertification(); 
Response response = null; 
try {
LOGGER.info("URL : ()", EnvironmentPath.GET LIMITS TRANSACTION_PATH_URI + urlParameters); 
response = RestAssured.given().spec(spec).when().contentType(ContentType. JSON).headers(headers).get(EnvironmentPath.GET_LIMITS TRANSACTION_PATH URI + urlParameters).then().extract().response(); }
catch (Exception e) {
LOGGER.error("GET_REQUEST_NOT_PROCESSED- there was an exception raised while processing the request"); 
throw new DPMSException("GET_REQUEST_NOT_PROCESSED - there was an exception raised while processing the request
return response;


should be

public static Response getRequest(String urlParameters, Map<string, string=""> headers) {
RequestSpecification spec = setCertification(); 
Response response = null; 
try {
LOGGER.info("URL : ()", EnvironmentPath.GET LIMITS TRANSACTION_PATH_URI + urlParameters); 
response = RestAssured.given().spec(spec).when().contentType(ContentType. JSON).headers(headers).get(EnvironmentPath.GET_LIMITS TRANSACTION_PATH URI + urlParameters).then().extract().response(); }
catch (Exception e) {
LOGGER.error("GET_REQUEST_NOT_PROCESSED- there was an exception raised while processing the request"); 
throw new DPMSException("GET_REQUEST_NOT_PROCESSED - there was an exception raised while processing the request"); }
return response; }


Please let me know if that fixes the problem - I am not a Java developer, so I'm using my C# and (intermediate) Javascript knowledge here
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900