-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnector.java
More file actions
31 lines (25 loc) · 771 Bytes
/
Copy pathConnector.java
File metadata and controls
31 lines (25 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package connector;
import io.restassured.response.Response;
import static io.restassured.RestAssured.given;
import data.Endpoint;
public class Connector {
private String baseUrl = Endpoint.BASE_URL;
public Response getRequest(int userId) {
String path = Endpoint.USERS + "/" + userId;
return given()
.when()
.get(baseUrl + path)
.then()
.extract().response();
}
public Response postRequest(String payload) {
String path = Endpoint.USERS;
return given()
.header("Content-Type", "application/json")
.body(payload)
.when()
.post(baseUrl + path)
.then()
.extract().response();
}
}