Skip to content

Commit

Permalink
Rename value class attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasberglund committed Sep 27, 2024
1 parent 9aee729 commit 73c267f
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import org.junit.jupiter.api.fail

@JvmInline
@Serializable(with = PacketCaptureSessionAsStringSerializer::class)
value class PacketCaptureSession(val uuid: UUID = UUID.randomUUID())
value class PacketCaptureSession(val value: UUID = UUID.randomUUID())

object PacketCaptureSessionAsStringSerializer : KSerializer<PacketCaptureSession> {
override val descriptor: SerialDescriptor = String.serializer().descriptor
Expand All @@ -49,7 +49,7 @@ object PacketCaptureSessionAsStringSerializer : KSerializer<PacketCaptureSession
}

override fun serialize(encoder: Encoder, value: PacketCaptureSession) {
encoder.encodeString(value.uuid.toString())
encoder.encodeString(value.value.toString())
}
}

Expand Down Expand Up @@ -126,21 +126,21 @@ class PacketCaptureClient(private val httpClient: HttpClient = defaultHttpClient
}

suspend fun sendStopCaptureRequest(session: PacketCaptureSession) {
Logger.v("Sending stop capture request for session ${session.uuid}")
httpClient.post("$BASE_URL/stop-capture/${session.uuid.toString()}")
Logger.v("Sending stop capture request for session ${session.value}")
httpClient.post("$BASE_URL/stop-capture/${session.value.toString()}")
}

suspend fun sendGetCapturedPacketsRequest(session: PacketCaptureSession): HttpResponse {
val testDeviceIpAddress = Networking.getIpAddress()
return httpClient.put("$BASE_URL/parse-capture/${session.uuid.toString()}") {
return httpClient.put("$BASE_URL/parse-capture/${session.value.toString()}") {
contentType(ContentType.Application.Json)
accept(ContentType.Application.Json)
setBody("[\"$testDeviceIpAddress\"]")
}
}

suspend fun sendGetPcapFileRequest(session: PacketCaptureSession): HttpResponse {
return httpClient.get("$BASE_URL/last-capture/${session.uuid.toString()}") {
return httpClient.get("$BASE_URL/last-capture/${session.value.toString()}") {
// contentType(ContentType.parse("application/pcap"))
accept(ContentType.parse("application/json"))
}
Expand Down

0 comments on commit 73c267f

Please sign in to comment.