Skip to content

Fix null request bodies for PUT requests - #281

Closed
ferid333 wants to merge 1 commit into
apple:mainfrom
ferid333:emptyBodyForNullPutRequest
Closed

Fix null request bodies for PUT requests#281
ferid333 wants to merge 1 commit into
apple:mainfrom
ferid333:emptyBodyForNullPutRequest

Conversation

@ferid333

@ferid333 ferid333 commented Aug 28, 2026

Copy link
Copy Markdown

Summary

Fixes null request bodies for PUT requests by sending an empty request body instead of passing null to OkHttp.

Problem

While reading through the request-building code, I noticed that POST requests with a null body were already converted to an empty byte array before building the OkHttp request. However, PUT requests were not handled the
same way.

When a PUT endpoint is called with a null request object, the client can call:

requestBuilder.method("PUT", null)                                                                                                                                                                                                

Expected Behavior

The client should build a valid PUT request with a zero-length request body, matching the existing behavior for null-body POST requests.

Changes

  • Converts null bodies for POST and PUT requests into an empty byte array.
  • Adds test coverage for a null-body PUT request.

@ferid333 ferid333 closed this by deleting the head repository Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant