Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdk/core/azure-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

### Bugs Fixed

- Fixed a bug where `text/event-stream` content type wasn't being handled correctly.
Replaced content type exact match `equals` by `startsWith`. ([#39128](https://github.com/Azure/azure-sdk-for-java/issues/39128))

### Other Changes

## 1.47.0 (2024-03-01)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static Mono<?> handleBodyReturnType(HttpResponse sourceResponse, Function<byte[]
// different methods to read the response. The reading of the response is delayed until BinaryData
// is read and depending on which format the content is converted into, the response is not necessarily
// fully copied into memory resulting in lesser overall memory usage.
if (TEXT_EVENT_STREAM.equals(contentType)) {
if (contentType != null && contentType.startsWith(TEXT_EVENT_STREAM)) {
// if the response content type is a stream, create a BinaryData instance with bufferContent set to
// false.
asyncResult = BinaryData.fromFlux(sourceResponse.getBody(), null, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public static Stream<Arguments> getResponseHeaderAndReplayability() {
Arguments.of(new HttpHeaders().set(HttpHeaderName.CONTENT_TYPE, ContentType.APPLICATION_OCTET_STREAM),
true),
Arguments.of(new HttpHeaders().set(HttpHeaderName.CONTENT_TYPE, "text/event-stream"), false),
Arguments.of(new HttpHeaders().set(HttpHeaderName.CONTENT_TYPE, "text/event-stream; charset=utf-8"), false),
Arguments.of(new HttpHeaders().set(HttpHeaderName.CONTENT_TYPE, ContentType.APPLICATION_JSON), true),
Arguments.of(new HttpHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/xml"), true));
}
Expand Down