Reputation: 134
Find below my scenario:
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();
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
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