Amplify-android: REST API converts PUT and POST with no body into GET request in-flight

Created on 27 May 2020  路  5Comments  路  Source: aws-amplify/amplify-android

OkHttp seems to convert in-flight POST and PUT requests to GET requests if the body provided is null. This is surprising.

In order to address this, RestOptions should be changed to:

  1. Ensure that the constructor cannot be called directly, rather we should prefer RestOptions.Builder
  2. In the constructor, if provided data is null, pass an empty byte[]
API Bug

All 5 comments

when will this bug be addressed?

@c0rdeiro Soon. :) For now, you can work around it by providing an empty body. A better fix is forthcoming.

Thank you so much, this was driving me insane in the last 2 days

Same here! Sorry for the trouble.

Got a PR for it right here @c0rdeiro : https://github.com/aws-amplify/amplify-android/pull/539

Was this page helpful?
0 / 5 - 0 ratings