mirror of
https://github.com/hmalik144/api-testing-automation-framework.git
synced 2026-03-18 07:26:17 +00:00
readme.md added
This commit is contained in:
7
src/main/kotlin/org/example/api/ApiUtils.kt
Normal file
7
src/main/kotlin/org/example/api/ApiUtils.kt
Normal file
@@ -0,0 +1,7 @@
|
||||
package org.example.api
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun createBasicAuthTokenForHeader(username: String, password: String) =
|
||||
StringBuilder("Basic ").append(Base64.getEncoder().encodeToString("$username:$password".toByteArray()))
|
||||
.toString()
|
||||
@@ -36,7 +36,6 @@ class BookerApi {
|
||||
.setLenient()
|
||||
.create()
|
||||
|
||||
|
||||
private fun buildOkHttpClient(timeoutSeconds: Long = 30L): OkHttpClient {
|
||||
val builder = OkHttpClient.Builder()
|
||||
|
||||
|
||||
@@ -33,20 +33,20 @@ interface RestfulBookerApi {
|
||||
suspend fun updateBooking(
|
||||
@Path("id") id: String,
|
||||
@Body booking: BookingRequest,
|
||||
@Header("Authorization") token: String
|
||||
@Header("Authorization") basicHeaderToken: String
|
||||
): Response<BookingResponse>
|
||||
|
||||
@Headers("Content-Type:application/json", "Accept: application/json")
|
||||
@PATCH("booking/{id}")
|
||||
suspend fun partialUpdateBooking(
|
||||
@Path("id") id: String,
|
||||
@Header("Authorization") token: String,
|
||||
@Header("Authorization") basicHeaderToken: String,
|
||||
@Body update: UpdateBookingRequest
|
||||
): Response<BookingResponse>
|
||||
|
||||
@DELETE("booking/{id}")
|
||||
suspend fun deleteBooking(
|
||||
@Path("id") id: String,
|
||||
@Header("Authorization") token: String
|
||||
@Header("Authorization") basicHeaderToken: String
|
||||
): Response<Any>
|
||||
}
|
||||
@@ -7,5 +7,5 @@ data class BookingResponse(
|
||||
var totalprice: Int,
|
||||
var depositpaid: Boolean,
|
||||
var bookingdates: Bookingdates,
|
||||
var additionalneeds: String
|
||||
var additionalneeds: String?
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="warn">
|
||||
<Properties>
|
||||
<Property name="basePath">Classpath</Property>
|
||||
<Property name="basePath">./</Property>
|
||||
</Properties>
|
||||
<Appenders>
|
||||
<RollingFile name="fileLogger" fileName="${basePath}/app-info.html"
|
||||
|
||||
Reference in New Issue
Block a user