Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Improve the logic of proxyReqRes method #337

Merged
merged 1 commit into from
Jul 19, 2019

Conversation

mykola-mokhnach
Copy link
Contributor

proxyCommand call already returns an object, so there is no need to perform double conversion there. Also, it only makes sense to call stringily if the body object has been modified to save resources.

@mykola-mokhnach mykola-mokhnach merged commit 4472331 into appium:master Jul 19, 2019
@mykola-mokhnach mykola-mokhnach deleted the json_trans branch July 19, 2019 18:03
body = util.safeJsonParse(body);
if (body && body.sessionId) {
let isResBodyModified = false;
if (_.has(resBodyObj, 'sessionId')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could there ever be a situation where resBodyObj is a JSON string rather than an object here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isPlainObject check should take care of this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as for now proxyCommand will always return an object as the second argument

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.

3 participants