Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

feat(web/ios): allow string value in body #196

Merged

Conversation

emily-curry
Copy link
Contributor

@emily-curry emily-curry commented Nov 9, 2021

This change allows one to use a string value as the body of the request, and have that value be written directly to the request object without any marshalling/unmarshalling to/from JSValue objects.

The use case for this is more of a workaround than a feature. I have observed (though I'm finding it quite difficult to pin down all of the exact conditions), that sometimes with large deeply-nested objects, that the conversion from POJO -> capacitor bridge -> JSValue -> JSObject is not always consistent between platforms, and sometimes omits data. For example, on Android, if I have a POJO with a key that is the literal value null, when a JSObject is constructed from that object, that key+value pair is omitted. In my opinion, it is very important that for this plugin in particular we are able to guarantee that the requests are sent exactly as written. Sending strings over the bridge allows us to have that guarantee, at least for non-binary utf8 content. If ionic-team/capacitor#984 is implemented, blobs and maybe typedarrays could be future enhancements that give that guarantee for all data.

No changes were made to the Android implementation because this is already the current behavior, it just writes strings as-is.

This is based on #149, because it touches some of the same code and would cause conflicts.

shanselm-ergon and others added 26 commits July 20, 2021 09:47
…HTTP method (each HTTP method may have a body or not).
Add note that we use ergon-master branch
Adjust data handling in the ios HttpRequestHandler to check the data, if available, for correctness and fail otherwise.
Remove duplicat code, sorry for that.
…HTTP method (each HTTP method may have a body or not).
Adjust data handling in the ios HttpRequestHandler to check the data, if available, for correctness and fail otherwise.
Remove duplicat code, sorry for that.
* chore(iOS): remove local pods from project
* refactor: add postbuild script to install up to date pods
* refactor: change postbuild to prepublishOnly
* release: release 1.1.2
…os (capacitor-community#157)

* Update HttpOptions
* Add support for disabling automatic HTTP redirects on android
* Add support for disabling automatic HTTP redirects on ios
This reverts commit aa6d19e.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants