diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsHttpResponse.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsHttpResponse.java index 6108b8d86e4..7100b84300e 100644 --- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsHttpResponse.java +++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsHttpResponse.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.io.StringReader; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -33,6 +34,8 @@ import java.util.concurrent.ConcurrentHashMap; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.apache.commons.lang3.ObjectUtils; + import ca.uhn.fhir.rest.client.api.IHttpResponse; /** @@ -115,6 +118,12 @@ public class JaxRsHttpResponse implements IHttpResponse { @Override public InputStream readEntity() { return myResponse.readEntity(java.io.InputStream.class); + } + + @Override + public List getHeaders(String theName) { + List retVal = myResponse.getStringHeaders().get(theName); + return retVal; } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SubscriptionsDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SubscriptionsDstu3Test.java index 615a39186c9..493ea0f7134 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SubscriptionsDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SubscriptionsDstu3Test.java @@ -125,6 +125,8 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test { public void testCreateInvalidNoStatus() { Subscription subs = new Subscription(); subs.getChannel().setType(SubscriptionChannelType.RESTHOOK); + subs.getChannel().setPayload("application/fhir+json"); + subs.getChannel().setEndpoint("http://localhost:8888"); subs.setCriteria("Observation?identifier=123"); try { ourClient.create().resource(subs).execute(); @@ -362,6 +364,8 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test { public void testUpdateFails() { Subscription subs = new Subscription(); subs.getChannel().setType(SubscriptionChannelType.RESTHOOK); + subs.getChannel().setPayload("application/fhir+json"); + subs.getChannel().setEndpoint("http://localhost:8888"); subs.setStatus(SubscriptionStatus.REQUESTED); subs.setCriteria("Observation?identifier=123"); IIdType id = ourClient.create().resource(subs).execute().getId().toUnqualifiedVersionless(); @@ -392,6 +396,8 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test { public void testUpdateToInvalidStatus() { Subscription subs = new Subscription(); subs.getChannel().setType(SubscriptionChannelType.RESTHOOK); + subs.getChannel().setPayload("application/fhir+json"); + subs.getChannel().setEndpoint("http://localhost:8888"); subs.setCriteria("Observation?identifier=123"); subs.setStatus(SubscriptionStatus.REQUESTED); IIdType id = ourClient.create().resource(subs).execute().getId();