Adding the @Produces annotation for the GET endpoints in the Network Map service (#652)

This commit is contained in:
Michal Kit 2018-03-29 15:09:39 +01:00 committed by GitHub
parent bf5f812b68
commit 296e74aca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,10 +115,12 @@ class NetworkMapWebService(private val nodeInfoStorage: NodeInfoStorage,
} }
@GET @GET
@Produces(MediaType.APPLICATION_OCTET_STREAM)
fun getNetworkMap(): Response = createResponse(currentSignedNetworkMap, addCacheTimeout = true) fun getNetworkMap(): Response = createResponse(currentSignedNetworkMap, addCacheTimeout = true)
@GET @GET
@Path("node-info/{nodeInfoHash}") @Path("node-info/{nodeInfoHash}")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
fun getNodeInfo(@PathParam("nodeInfoHash") nodeInfoHash: String): Response { fun getNodeInfo(@PathParam("nodeInfoHash") nodeInfoHash: String): Response {
// Only serve node info if its in the current network map, otherwise return 404. // Only serve node info if its in the current network map, otherwise return 404.
logger.trace { "Processing node info request for hash: '$nodeInfoHash'" } logger.trace { "Processing node info request for hash: '$nodeInfoHash'" }
@ -134,6 +136,7 @@ class NetworkMapWebService(private val nodeInfoStorage: NodeInfoStorage,
@GET @GET
@Path("network-parameters/{hash}") @Path("network-parameters/{hash}")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
fun getNetworkParameters(@PathParam("hash") hash: String): Response { fun getNetworkParameters(@PathParam("hash") hash: String): Response {
val signedNetParams = networkMapStorage.getSignedNetworkParameters(SecureHash.parse(hash)) val signedNetParams = networkMapStorage.getSignedNetworkParameters(SecureHash.parse(hash))
logger.trace { "Precessed network parameter request for hash: '$hash'" } logger.trace { "Precessed network parameter request for hash: '$hash'" }