added header check
This commit is contained in:
parent
ad5297b714
commit
c913707599
|
@ -586,7 +586,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
|||
throw new MethodNotAllowedException("_expunge is not enabled on this server: " + getConfig().cannotDeleteExpungeReason());
|
||||
}
|
||||
|
||||
if (theUrl.contains("_cascade")) {
|
||||
if (theUrl.contains(JpaConstants.PARAM_DELETE_CASACADE) || theRequest.getHeader("X-Cascade").equals("delete")) {
|
||||
throw new NotImplementedOperationException("_expunge cannot be used with _cascade");
|
||||
}
|
||||
|
||||
|
|
|
@ -67,10 +67,11 @@ class DeleteExpungeDaoTest extends BaseJpaR4Test {
|
|||
|
||||
// Try to delete _cascade and _expunge on the organization
|
||||
BaseServerResponseException e = assertThrows(BaseServerResponseException.class, () -> {myOrganizationDao
|
||||
.deleteByUrl("Organization?" + "_cascade=true&" + JpaConstants.PARAM_DELETE_EXPUNGE + "=true", mySrd);});
|
||||
.deleteByUrl("Organization?" + "_cascade=delete&" + JpaConstants.PARAM_DELETE_EXPUNGE + "=true", mySrd);});
|
||||
|
||||
// Get not implemented HTTP 501 error
|
||||
assertEquals(Constants.STATUS_HTTP_501_NOT_IMPLEMENTED, e.getStatusCode());
|
||||
assertEquals("_expunge cannot be used with _cascade", e.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -200,6 +200,12 @@ public class JpaConstants {
|
|||
|
||||
public static final String PARAM_DELETE_EXPUNGE = "_expunge";
|
||||
|
||||
/**
|
||||
* Parameter for delete to indicate the resource should be cascading delete
|
||||
*/
|
||||
|
||||
public static final String PARAM_DELETE_CASACADE = "_cascade";
|
||||
|
||||
/**
|
||||
* URL for extension on a SearchParameter indicating that text values should not be indexed
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue