Why does event deletion respond with Transfer-Encoding header, violating the HTTP spec?

Tynstar81 31 Reputation points
2023-04-08T10:56:58.4033333+00:00

Since February 24, 2023, whenever my application deletes a calendar event, the java.net.http HttpClient throws an IOException saying "unexpected content length header with 204 response". Reading the source, one can see that despite the wording of that message, it is also used when a Transfer-Encoding header is set.

Looking at the response to any DELETE /me/calendars/{id}/events/{id} call, one can clearly see that MS Graph includes a Transfer-Encoding header despite this being a 204 status.

Note: For this Q&A post, I had to replace the : after Transfer-Encoding with something else, otherwise I would get an error. See my answer to this other post.

HTTP/1.1 204 No Content
Cache-Control: private
Transfer-Encoding⚠️ chunked
Strict-Transport-Security: max-age=31536000
request-id: *redacted*
client-request-id: *redacted*
x-ms-ags-diagnostic: *redacted*
Preference-Applied: IdType=ImmutableId
Date: Wed, 05 Apr 2023 09:00:16 GMT

As far as I understand section 6.1 "Transfer-Encoding" of RFC 9112, the HttpClient class rightfully complains about this:

A server MUST NOT send a Transfer-Encoding header field in any response with a status code of 1xx (Informational) or 204 (No Content).

Note that the event is deleted successfully. However, due to the HTTP spec violation, a client application would usually fail and assume the deletion was not performed. But even in case the application is written to catch and ignore this specific exception (as is mine now), it will still slow down due to the exception being thrown.

So far, my production server logged 1037 occurrences of this problem. I therefore guess these are the majority or even all deletion requests issued to MS Graph. A manual test I performed this week showed the same problem (response quoted above). Before, my application was running for months and MS Graph never responded like this.

Is there anything I am overlooking? Can anybody else confirm the presence of the Transfer-Encoding header? Was this an intentional change?

Best regards,
Jens Bannmann

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,889 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more