Merge pull request #1022 from alinleonard/master

Patch operation on OperationsWhichAllowPreferHeader
This commit is contained in:
James Agnew 2018-08-12 17:55:16 -04:00 committed by GitHub
commit 78a7d64d2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -56,7 +56,7 @@ import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<MethodOutcome> {
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;
@ -99,11 +99,11 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
return Constants.STATUS_HTTP_200_OK;
case UPDATE:
case PATCH:
if (response == null || response.getCreated() == null || Boolean.FALSE.equals(response.getCreated())) {
return Constants.STATUS_HTTP_200_OK;
}
return Constants.STATUS_HTTP_201_CREATED;
case VALIDATE:
case DELETE:
default:

View File

@ -1786,7 +1786,7 @@ public class AuthorizationInterceptorDstu2Test {
httpPost.setEntity(new StringEntity(input, ContentType.parse("application/json-patch+json")));
status = ourClient.execute(httpPost);
response = extractResponseAndClose(status);
assertEquals(204, status.getStatusLine().getStatusCode());
assertEquals(200, status.getStatusLine().getStatusCode());
assertTrue(ourHitMethod);
}

View File

@ -1687,7 +1687,7 @@ public class AuthorizationInterceptorR4Test {
patch.setEntity(new StringEntity(patchBody, ContentType.create(Constants.CT_JSON_PATCH, Charsets.UTF_8)));
CloseableHttpResponse status = ourClient.execute(patch);
extractResponseAndClose(status);
assertEquals(204, status.getStatusLine().getStatusCode());
assertEquals(200, status.getStatusLine().getStatusCode());
assertTrue(ourHitMethod);
}
@ -2964,7 +2964,7 @@ public class AuthorizationInterceptorR4Test {
httpPost.setEntity(new StringEntity(input, ContentType.parse("application/json-patch+json")));
status = ourClient.execute(httpPost);
extractResponseAndClose(status);
assertEquals(204, status.getStatusLine().getStatusCode());
assertEquals(200, status.getStatusLine().getStatusCode());
assertTrue(ourHitMethod);
}