New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[spaceship] parse response body as json if not already #18766
[spaceship] parse response body as json if not already #18766
Conversation
parse response body as json if not already
Hi @ilendemli 👋 , |
return body | ||
end | ||
|
||
return JSON.parse(body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to rescue an error here if it can't parse and display something somewhat user friendly 🤔 Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed this part of the code, but I am doing the same as in other places.
Hey @max-ott! I traced the call: I am now doing the same as in Not sure if I have missed something else. EDIT: I don't have any steps i can give. I have projects with different teams where i changed the fastlane instance to my cloned repo and then debugged using a breakpoint and compared responses by stepping through fastlane. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! I added a little bit to it and some tests. I really appreciate the contribution ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congratulations! 🎉 This was released as part of fastlane 2.186.0 🚀
Checklist
bundle exec rspec
from the root directory to see all new and existing tests passbundle exec rubocop -a
to ensure the code style is validMotivation and Context
spaceship
failed to parse an api-responses such as expired membership when runningfastlane match
. This MR checks if the respone body is an object of typeString
and parses the body as a JSON object if that is the case (better handling for #18431 and similar failures).Description
updates
handle_error
andformat_errors
inSpaceshipt::ConnectAPIT::APIClient
and checks wetherresponse.body
is empty or not. uses an empty object if String is empty. Then parses result as JSON if the result is tyoe of stringTesting Steps
rspec
andrubocop
went through as-well asbundle exec fastlane test