Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ApiClient {
- fun makeRequest(
- path: String,
- token: String = "",
- body: String = "",
- code: Int,
- time: Long = 2000L,
- a: RequestSpecification.() -> Response
- ): ProfileModel.Model {
- val responseData = Given {
- contentType(ContentType.JSON)
- contentType("application/json")
- header("access-token", token)
- body(body)
- } When {
- get(path)
- } Then {
- statusCode(code)
- time(lessThan(time))
- } Extract {
- to<ProfileModel.Model>()
- }
- return responseData
- }
- fun a() {
- makeRequest("", "", "", 0, 200) {
- get()
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement