Merge pull request #1022 from alinleonard/master
Patch operation on OperationsWhichAllowPreferHeader
This commit is contained in:
commit
78a7d64d2c
|
@ -56,7 +56,7 @@ import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||||
abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<MethodOutcome> {
|
abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<MethodOutcome> {
|
||||||
static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseOutcomeReturningMethodBinding.class);
|
static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseOutcomeReturningMethodBinding.class);
|
||||||
|
|
||||||
private static EnumSet<RestOperationTypeEnum> ourOperationsWhichAllowPreferHeader = EnumSet.of(RestOperationTypeEnum.CREATE, RestOperationTypeEnum.UPDATE);
|
private static EnumSet<RestOperationTypeEnum> ourOperationsWhichAllowPreferHeader = EnumSet.of(RestOperationTypeEnum.CREATE, RestOperationTypeEnum.UPDATE, RestOperationTypeEnum.PATCH);
|
||||||
|
|
||||||
private boolean myReturnVoid;
|
private boolean myReturnVoid;
|
||||||
|
|
||||||
|
@ -99,11 +99,11 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
|
||||||
return Constants.STATUS_HTTP_200_OK;
|
return Constants.STATUS_HTTP_200_OK;
|
||||||
|
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
|
case PATCH:
|
||||||
if (response == null || response.getCreated() == null || Boolean.FALSE.equals(response.getCreated())) {
|
if (response == null || response.getCreated() == null || Boolean.FALSE.equals(response.getCreated())) {
|
||||||
return Constants.STATUS_HTTP_200_OK;
|
return Constants.STATUS_HTTP_200_OK;
|
||||||
}
|
}
|
||||||
return Constants.STATUS_HTTP_201_CREATED;
|
return Constants.STATUS_HTTP_201_CREATED;
|
||||||
|
|
||||||
case VALIDATE:
|
case VALIDATE:
|
||||||
case DELETE:
|
case DELETE:
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1786,7 +1786,7 @@ public class AuthorizationInterceptorDstu2Test {
|
||||||
httpPost.setEntity(new StringEntity(input, ContentType.parse("application/json-patch+json")));
|
httpPost.setEntity(new StringEntity(input, ContentType.parse("application/json-patch+json")));
|
||||||
status = ourClient.execute(httpPost);
|
status = ourClient.execute(httpPost);
|
||||||
response = extractResponseAndClose(status);
|
response = extractResponseAndClose(status);
|
||||||
assertEquals(204, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
assertTrue(ourHitMethod);
|
assertTrue(ourHitMethod);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1687,7 +1687,7 @@ public class AuthorizationInterceptorR4Test {
|
||||||
patch.setEntity(new StringEntity(patchBody, ContentType.create(Constants.CT_JSON_PATCH, Charsets.UTF_8)));
|
patch.setEntity(new StringEntity(patchBody, ContentType.create(Constants.CT_JSON_PATCH, Charsets.UTF_8)));
|
||||||
CloseableHttpResponse status = ourClient.execute(patch);
|
CloseableHttpResponse status = ourClient.execute(patch);
|
||||||
extractResponseAndClose(status);
|
extractResponseAndClose(status);
|
||||||
assertEquals(204, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
assertTrue(ourHitMethod);
|
assertTrue(ourHitMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2964,7 +2964,7 @@ public class AuthorizationInterceptorR4Test {
|
||||||
httpPost.setEntity(new StringEntity(input, ContentType.parse("application/json-patch+json")));
|
httpPost.setEntity(new StringEntity(input, ContentType.parse("application/json-patch+json")));
|
||||||
status = ourClient.execute(httpPost);
|
status = ourClient.execute(httpPost);
|
||||||
extractResponseAndClose(status);
|
extractResponseAndClose(status);
|
||||||
assertEquals(204, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
assertTrue(ourHitMethod);
|
assertTrue(ourHitMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue