Skip to content
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

Update generator to consider 201 as success response code #83

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

Chandra158
Copy link
Contributor

@Chandra158 Chandra158 commented Aug 31, 2023

Overview

The generated graph from swagger docs only considers 200 as success response code.
For the purpose of fuzz-lightyear, 201 is another useful response code mainly used for create apis.

How has this been tested

  • Existing test passes
  • Added new test for existing api in vulnerable_app

@Chandra158 Chandra158 merged commit 61e34e2 into Yelp:master Aug 31, 2023
3 checks passed
@@ -140,6 +140,8 @@ def _generate_request_graph() -> Dict[str, set]:
for operation_id in dir(getattr(client, tag_group)):
operation = getattr(getattr(client, tag_group), operation_id).operation
responses = operation.op_spec.get('responses', {}).get('200', {})
if not responses:

Choose a reason for hiding this comment

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

Im just suggesting this cause 200 and 201 are not happening the same time!

Suggested change
if not responses:
responses = operation.op_spec.get('responses', {})
responses = responses.get('200', {}) or responses.get('201', {})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks good. I'll include it with future changes 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants