Skip to content

Commit

Permalink
Use PUT for /exchanges/:exchangeId in client
Browse files Browse the repository at this point in the history
  • Loading branch information
Diane Huxley committed Mar 28, 2024
1 parent 14aff82 commit 5f3b9b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ object TbdexHttpClient {
val request = Request.Builder()
.url(url)
.addHeader("Content-Type", JSON_HEADER)
.post(requestBody)
.put(requestBody)
.build()

println("Attempting to send message to exchange ${exchangeId} to: ${request.url}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class TbdexHttpClientTest {
assertDoesNotThrow { TbdexHttpClient.createExchange(rfq) }

val request = server.takeRequest()
assertEquals(request.method, "POST")
assertEquals(request.path, "/exchanges")
assertEquals(
Json.jsonMapper.readTree(request.body.readUtf8()),
Expand All @@ -111,6 +112,7 @@ class TbdexHttpClientTest {
assertDoesNotThrow { TbdexHttpClient.createExchange(rfq, replyTo) }

val request = server.takeRequest()
assertEquals(request.method, "POST")
assertEquals(request.path, "/exchanges")
assertEquals(
Json.jsonMapper.readTree(request.body.readUtf8()),
Expand Down Expand Up @@ -195,6 +197,7 @@ class TbdexHttpClientTest {
assertDoesNotThrow { TbdexHttpClient.submitOrder(order) }

val request = server.takeRequest()
assertEquals(request.method, "PUT")
assertEquals(request.path, "/exchanges/${order.metadata.exchangeId}")
assertEquals(
Json.jsonMapper.readTree(request.body.readUtf8()),
Expand Down Expand Up @@ -253,6 +256,7 @@ class TbdexHttpClientTest {
assertDoesNotThrow { TbdexHttpClient.submitClose(close) }

val request = server.takeRequest()
assertEquals(request.method, "PUT")
assertEquals(request.path, "/exchanges/${close.metadata.exchangeId}")
assertEquals(
Json.jsonMapper.readTree(request.body.readUtf8()),
Expand Down

0 comments on commit 5f3b9b6

Please sign in to comment.