Merge branch 'master' of github.com:jamesagnew/hapi-fhir
This commit is contained in:
commit
3ff29370e6
|
@ -75,6 +75,7 @@ import ca.uhn.fhir.rest.server.exceptions.AuthenticationException;
|
|||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.NotModifiedException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.rest.server.interceptor.ExceptionHandlingInterceptor;
|
||||
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
|
||||
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
|
||||
|
@ -253,7 +254,7 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
|
|||
} else {
|
||||
resourceBinding = myResourceNameToBinding.get(resourceName);
|
||||
if (resourceBinding == null) {
|
||||
throw new InvalidRequestException("Unknown resource type '" + resourceName + "' - Server knows how to handle: " + myResourceNameToBinding.keySet());
|
||||
throw new ResourceNotFoundException("Unknown resource type '" + resourceName + "' - Server knows how to handle: " + myResourceNameToBinding.keySet());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1431,6 +1431,8 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||
for (ResourceLink next : links) {
|
||||
myEntityManager.persist(next);
|
||||
}
|
||||
// make sure links are indexed
|
||||
theEntity.setResourceLinks(links);
|
||||
|
||||
theEntity.toString();
|
||||
|
||||
|
|
|
@ -527,7 +527,7 @@ public class RestfulServerMethodTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidResourceTriggers400() throws Exception {
|
||||
public void testInvalidResourceTriggers404() throws Exception {
|
||||
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/FooResource?blah=bar");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
|
@ -537,7 +537,7 @@ public class RestfulServerMethodTest {
|
|||
|
||||
ourLog.info("Response was:\n{}", responseContent);
|
||||
|
||||
assertEquals(400, status.getStatusLine().getStatusCode());
|
||||
assertEquals(404, status.getStatusLine().getStatusCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ServerFeaturesDstu2Test {
|
|||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
ourLog.info(responseContent);
|
||||
assertEquals(400, status.getStatusLine().getStatusCode());
|
||||
assertEquals(404, status.getStatusLine().getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -171,7 +171,7 @@ public class ResponseHighlightingInterceptorTest {
|
|||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
ourLog.info("Resp: {}", responseContent);
|
||||
assertEquals(400, status.getStatusLine().getStatusCode());
|
||||
assertEquals(404, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertThat(responseContent, not(stringContainsInOrder("<span class='hlTagName'>OperationOutcome</span>", "Unknown resource type 'Foobar' - Server knows how to handle")));
|
||||
assertThat(responseContent, (stringContainsInOrder("Unknown resource type 'Foobar'")));
|
||||
|
|
|
@ -217,6 +217,11 @@
|
|||
JPA server terminology service was not correctly validating or expanding codes
|
||||
in SNOMED CT or LOINC code systems. Thanks to David Hay for reporting!
|
||||
</action>
|
||||
<action type="fix" issue="539">
|
||||
Attempting to search for an invalid resource type (e.g. GET base/FooResource) should
|
||||
return an HTTP 404 and not a 400, per the HTTP spec. Thanks to
|
||||
GitHub user @CarthageKing for the pull request!
|
||||
</action>
|
||||
</release>
|
||||
<release version="2.1" date="2016-11-11">
|
||||
<action type="add">
|
||||
|
|
Loading…
Reference in New Issue