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

feat: Extend client.setDefault[Request,Headers] to accept objects #771

Merged
merged 7 commits into from
Oct 9, 2020

Conversation

aslafy-z
Copy link
Contributor

@aslafy-z aslafy-z commented Oct 5, 2018

Fixes #642

Checklist

  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the [Contribution Guide] and my PR follows them.
  • I updated my branch with the master branch.
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation about the functionality in the appropriate .md file
  • I have added in line documentation to the code I modified

Short description of what this PR does:

  • Accept objects for modifying defaultRequest and defaultHeaders

eg: Configure request to use a sock proxy (#642 use case):

const client = require('@sendgrid/client');
const Agent = require('socks5-http-client/lib/Agent');

client.setDefaultRequest({
	agentClass: Agent,
	agentOptions: {
		socksHost: 'localhost',
		socksPort: 5555,
	},
});

// instead of

client.setDefaultRequest('agentClass', Agent);
client.setDefaultRequest('agentOptions', {
	socksHost: 'localhost',
	socksPort: 5555,
});

@thinkingserious thinkingserious added the status: code review request requesting a community code review or review from Twilio label Oct 5, 2018
@aslafy-z aslafy-z changed the title [client] Extend setDefault[Request,Headers] to accept objects WIP: [client] Extend setDefault[Request,Headers] to accept objects Oct 5, 2018
@aslafy-z
Copy link
Contributor Author

aslafy-z commented Oct 5, 2018

Not sure with the last commit, I'm new to typescript, would love a review. Thank you!

@thinkingserious
Copy link
Contributor

Hello @aslafy-z,

Thanks again for the PR!

It's HACKTOBERFEST! We want to show our appreciation by sending you some special Hacktoberfest swag. If you have not already, could you please fill out this form so we can send it to you? Thanks!

Team SendGrid DX

@aslafy-z aslafy-z changed the title WIP: [client] Extend setDefault[Request,Headers] to accept objects [client] Extend setDefault[Request,Headers] to accept objects Oct 16, 2018
Copy link

@Ditofry Ditofry left a comment

Choose a reason for hiding this comment

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

🕺 🎊 Thanks!

@SendGridDX
Copy link
Collaborator

SendGridDX commented Oct 30, 2018

CLA assistant check
All committers have signed the CLA.

@childish-sambino childish-sambino force-pushed the master branch 5 times, most recently from 389fa8c to 37473ad Compare January 15, 2020 21:44
@childish-sambino childish-sambino removed the type: twilio enhancement feature request on Twilio's roadmap label Jul 20, 2020
@thinkingserious thinkingserious changed the base branch from master to main July 28, 2020 14:34
@childish-sambino childish-sambino changed the title [client] Extend setDefault[Request,Headers] to accept objects feat: Extend client.setDefault[Request,Headers] to accept objects Oct 9, 2020
Copy link
Contributor

@childish-sambino childish-sambino left a comment

Choose a reason for hiding this comment

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

LGTM

@childish-sambino childish-sambino merged commit b9e10ec into sendgrid:main Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium fix is medium in difficulty status: code review request requesting a community code review or review from Twilio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for SOCKS5 Proxy for request
6 participants