[try] Image Size with networking on native client#1455
Conversation
siteSlug and extraHTTPHeaders were added to be used on apiFetch
4320681 to
e675c61
Compare
|
@mchowning FYI - Just rebased all relevant branches to keep them up to date. |
9a751e0 to
e675c61
Compare
| return response; | ||
| }; | ||
|
|
||
| return responsePromise.then( parseResponse ).catch( ( error ) => { |
There was a problem hiding this comment.
Do we need the then/error if they're just returning the passed value?
There was a problem hiding this comment.
I've updated parseResponse so it no longer just returns the passed value like it used to. I made this change because I have Android returning a json string because that's much simpler to do. If there's an issue with that I can certainly update it to return a json object like iOS.
With respect to the catch clause, I believe adding that does change the behavior so that now the resulting promise essentially "resolves" with the error (i.e., the resulting promise will pass the error in any subsequent then calls). Seems like this probably is not desired behavior. What do you think @etoledom ?
|
Hey @etoledom ! I merged the code from |
Helps to avoid getting unexpected responses and hard to track down bugs: wordpress-mobile/WordPress-iOS#12714 (comment)
…e-networking-native
|
Overall it looks good to me ✅ I have found a few issues that I think are beyond this (Networking specific) PR:
|
| 'wp/v1/media/', // made up example | ||
| ]; | ||
|
|
||
| describe( 'isPathSupported', () => { |
There was a problem hiding this comment.
Love the tests for this.
SergioEstevao
left a comment
There was a problem hiding this comment.
Tested this on iOS and it's working great.
I tested with WP.com normal, Atomic WP.com and self-hosted sites.
Love the use of Result and Promise in Swift and JS.
Great work.
Alternative to #1453
This PR pass the networking request intent to the client app, and awaits for a response.
As a proof of concept, this PR implements the minimum necessary to make Image Size works.
In the future we might need to pass the request method and parameters.
Related PRs:
To test on iOS refer to WPiOS PR: wordpress-mobile/WordPress-iOS#12714
To test on Android refer to WPAndroid PR: wordpress-mobile/WordPress-Android#10779
Update release notes:
RELEASE-NOTES.txt.