Skip to content

Commit c7c0d6d

Browse files
committed
fix entityId retrieval for when no "id" was selected via fields
1 parent 335a26c commit c7c0d6d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

gateway/service/src/main/java/org/eclipse/ditto/gateway/service/endpoints/actors/AbstractHttpRequestActor.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,13 @@ private void handleCommandAndAcceptImmediately(final Signal<?> command) {
336336
}
337337

338338
private void rememberResponseLocationUri(final CommandResponse<?> commandResponse) {
339-
final var optionalEntityId = WithEntityId.getEntityId(commandResponse);
340-
if (HttpStatus.CREATED.equals(commandResponse.getHttpStatus()) && optionalEntityId.isPresent()) {
341-
responseLocationUri =
342-
getUriForLocationHeader(httpRequest, optionalEntityId.get(), commandResponse.getResourcePath());
343-
logger.debug("Setting responseLocationUri=<{}> from request <{}>", responseLocationUri, httpRequest);
339+
if (HttpStatus.CREATED.equals(commandResponse.getHttpStatus())) {
340+
final var optionalEntityId = WithEntityId.getEntityId(commandResponse);
341+
if (optionalEntityId.isPresent()) {
342+
responseLocationUri =
343+
getUriForLocationHeader(httpRequest, optionalEntityId.get(), commandResponse.getResourcePath());
344+
logger.debug("Setting responseLocationUri=<{}> from request <{}>", responseLocationUri, httpRequest);
345+
}
344346
}
345347
}
346348

0 commit comments

Comments
 (0)