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 the request object with sensible defaults and access methods, #13 #15

Conversation

diegoc-am
Copy link
Contributor

No description provided.

Map<String,String> requestHeaders = new HashMap<String, String>();
requestHeaders.put("Authorization", "Bearer " + System.getenv("SENDGRID_API_KEY"));
request.headers = requestHeaders;
request.getHeaders().put("Authorization", "Bearer " + System.getenv("SENDGRID_API_KEY"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use a setter here instead?

e.g. request.addHeader("Authorization", "Bearer " + System.getenv("SENDGRID_API_KEY"));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

queryParams.put("offset", "0");
request.queryParams = queryParams;
request.getQueryParams().put("limit", "100");
request.getQueryParams().put("offset", "0");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use a setter here instead?

e.g. request.addQueryParam("offset", "0");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -39,7 +35,7 @@ public static void main(String[] args) throws IOException {
} catch (IOException ex) {
throw ex;
}
request.queryParams = null;
request.getQueryParams().clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

How about request.clearQueryParams();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@diegoc-am
Copy link
Contributor Author

Will update it later tonight! Thanks for the feedback

@thinkingserious thinkingserious added type: community enhancement feature request not on Twilio's roadmap status: cla signed status: work in progress Twilio or the community is in the process of implementing labels Oct 5, 2016
@diegoc-am
Copy link
Contributor Author

fixed!

@thinkingserious thinkingserious merged commit 433326b into sendgrid:master Oct 7, 2016
thinkingserious added a commit that referenced this pull request Oct 7, 2016
@diegoc-am diegoc-am deleted the make-request-object-have-sensible-default-13 branch June 2, 2017 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: work in progress Twilio or the community is in the process of implementing type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants