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

Adding support for headers for api calls #90

Merged
merged 3 commits into from
Apr 22, 2021

Conversation

utsabc
Copy link
Contributor

@utsabc utsabc commented Apr 20, 2021

Description

Custom Headers are necessary ingredients for making an authorized request to some end-points, hence support for passing in custom headers can improve the applicability of the service.

In this PR I have added support for adding headers while making GET API calls using the client. The new feature prompts users to input custom headers in their API calls. The user can choose to skip it by pressing enter, otherwise, they can provide a valid Header dictionary which will be parsed and added as headers in the API Call. If any exception occurs while parsing currently printing info [Parse error occured] and continuing the API request.

Inputs:
Screenshot 2021-04-20 at 8 53 56 PM

Webhook Output:
Screenshot 2021-04-20 at 8 54 11 PM

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

Screenshots

Original Updated
original screenshot updated screenshot

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🎉Congratulations!!🎉 for making your first PR , our mentors will review it soon.

@GouravSardana
Copy link
Member

LGTM but codacy test is failing because you have a variable called as ex but never used -
except Exception as ex:

@utsabc
Copy link
Contributor Author

utsabc commented Apr 21, 2021

LGTM but codacy test is failing because you have a variable called as ex but never used -
except Exception as ex:

@GouravSardana Hey sorry I missed it, fixed the issue.

@sonarcloud
Copy link

sonarcloud bot commented Apr 21, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@anshsrtv anshsrtv left a comment

Choose a reason for hiding this comment

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

LGTM! Curious if this can be made a little more interactive and user-friendly. 🤔

@GouravSardana
Copy link
Member

@anshsrtv Don't you think filling data in the terminal is more painful, if there were multi line header ?
We can open up new issue for that.

@utsabc
Copy link
Contributor Author

utsabc commented Apr 21, 2021

@anshsrtv Don't you think filling data in the terminal is more painful, if there were multi line header ?
We can open up new issue for that.

I was thinking if we could have some kind of a Text-Area input from the command-line itself, it could also be useful if you want to incorporate POST where you essentially want to parse some Stringified JSON input.

Need to check if there are any library available to do this.

@GouravSardana
Copy link
Member

@utsabc Please research and create an issue for the same. Meanwhile, I'll merge this change

@GouravSardana GouravSardana merged commit fcbd41b into IndianOpenSourceFoundation:master Apr 22, 2021
@utsabc
Copy link
Contributor Author

utsabc commented Apr 22, 2021

@utsabc Please research and create an issue for the same. Meanwhile, I'll merge this change

Sure

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