Sandy QA Proffessional
Sandy QA Proffessional

Reputation: 134

Unable to reach the API end point, on successive post call using Rest Assured

Find below my scenario:

  1. Post to API1, Extract a value from output json

    Code:

    Response response = given().header("Accept", "application/json").spec(requestSpec)
                       .when().post(API1)
                       .then().contentType(ContentType.JSON.extract().response();
    
  2. Post to API2 using the value extracted above.

    Code:

    Response response = given().headers("Authorization",authProp, "Content-Type","application/json").body(jsonString)
                       .when().post(API2)
                       .then().extract().response();
    

Issue:

When both are run in sequence (One Execution) Response of API2 is 404 not found, whereas if I run API1(1st Execution) store value to file in an execution close it. Then execute post to API2 (2nd execution)its successful (201 created status line is seen)

Please suggest if I missed something? i tried with Restassured.reset() in between the requests as well but same problem.

Note: Through postman, I am not seeing this issue.

Upvotes: 1

Views: 862

Answers (1)

Sandy QA Proffessional
Sandy QA Proffessional

Reputation: 134

Issue resolved: API1 works with proxy set while API2 doesnt with proxy! But i still wonder postman was smart to handle the proxy while rest assured wasn't. Could that be an improvement required, pick up proxy\non proxy from maven settings?

Upvotes: 1

Related Questions