Fixed IRS demo success case for PUT requests.

This commit is contained in:
Clinton Alexander 2016-06-08 16:45:19 +01:00
parent 146f274dd0
commit 2b64ba1cc6

View File

@ -22,6 +22,7 @@ import com.r3corda.demos.protocols.UpdateBusinessDayProtocol
import com.r3corda.node.internal.AbstractNode import com.r3corda.node.internal.AbstractNode
import com.r3corda.node.internal.testing.MockNetwork import com.r3corda.node.internal.testing.MockNetwork
import com.r3corda.node.services.network.InMemoryMessagingNetwork import com.r3corda.node.services.network.InMemoryMessagingNetwork
import com.r3corda.node.services.transactions.SimpleNotaryService
import joptsimple.OptionParser import joptsimple.OptionParser
import joptsimple.OptionSet import joptsimple.OptionSet
import joptsimple.OptionSpec import joptsimple.OptionSpec
@ -284,11 +285,13 @@ private fun sendJson(url: URL, data: String, method: String) : Boolean {
outStream.writeBytes(data) outStream.writeBytes(data)
outStream.close() outStream.close()
if (connection.responseCode == 201) { return when(connection.responseCode) {
return true 200 -> true
} else { 201 -> false
println("Failed to " + method + " data. Status Code: " + connection.responseCode + ". Mesage: " + connection.responseMessage) else -> {
return false println("Failed to " + method + " data. Status Code: " + connection.responseCode + ". Mesage: " + connection.responseMessage)
false
}
} }
} }