Giter Site home page Giter Site logo

java-http-client's People

Contributors

aholbreich avatar andy-trimble avatar bluestealth avatar danailminchev avatar diegoc-am avatar diegorramos avatar eshanholtz avatar huytranrjc avatar jennifermah avatar kazoni avatar kebeda avatar kikutaro avatar maxxedev avatar maxymshg avatar mbernier avatar mithunsasidharan avatar mptap avatar nightrainlily avatar pushkyn avatar rkaranam avatar shuron avatar shwetha-manvinkurke avatar skshelar avatar strum355 avatar sullis avatar thinkingserious avatar tsuyoshizawa avatar twilio-ci avatar twilio-dx avatar varpie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-http-client's Issues

Add our Developer Experience Engineer career opportunity to the README

Issue Summary

The role of Developer Experience Engineer just became available and we want to announce it in the README. Here is the copy:

If you're a software engineer who is passionate about #DeveloperExperience and/or #OpenSource, this is an incredible opportunity to join our #DX team as a Developer Experience Engineer and work with @thinkingserious and @aroach! Tell your friends :)

Acceptance Criteria

  • The above announcement is added to the Announcements section of this README

Add/Update Badges on README

Similar to what was done on the SendGrid node README:

  • put the logo at the top of the list
  • Add License like so
  • make sure the other badges are available like so:
![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)

For the following, make sure the correct repo is linked!
For email notifications, you can change the "nodejs" to the language of this repo (e.g. java, python, ruby, php, csharp, go, etc)

[![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-nodejs.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-nodejs)
[![Email Notifications Badge](https://dx.sendgrid.com/badge/nodejs)](https://dx.sendgrid.com/newsletter/nodejs)
[![npm](https://img.shields.io/npm/l/express.svg)]()
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-nodejs.svg)](https://github.com/sendgrid/sendgrid-nodejs/graphs/contributors)

Thank you and happy #Hacktoberfest!!

TravisCI failing with bad JAVA_HOME env var

Issue Summary

When travis is running, it is failing during the call to gradlew because of a faulty JAVA_HOME variable. please see the builds here: #27

Steps to Reproduce

  1. Make a PR
  2. Wait
  3. Travis Builds and shows an error in the log (click the summary box to see it)

Require conformance to style standards

Issue Summary

In the CONTRIBUTING.md file there is a section on Style Guidelines & Naming Conventions. Please review and implement a check in Travis CI. If there are any style errors, either fix or create a rule to exclude the error.

Before writing any code, we suggest you review our CONTRIBUTING.md file and propose your solution for discussion here in the comments. Thank you!

Aceptance Criteria

  • TravisCI checks that the code conforms to our Style Guidelines & Naming Conventions as defined in our CONTRIBUTING.md file
  • tests pass locally, in Travis CI and using Docker

Multi-byte character got garbled on received mail.

Issue Summary

When I was sending mail with Japanese multi-byte character via sendgrid-java v3.0.2, the received mail contents got garbled.Ex. こんにちは -> ?????

capture2

Pretty similar #4 but this is not sending but receiving.

Steps to Reproduce

Following simple code.

SendGrid sg = new SendGrid("api keys");
Request request = new Request();
Email from = new Email("[email protected]");
String subject = "こんにちは";
Email to = new Email("[email protected]");
Content content = new Content("text/plain", "こんにちは");
Mail mail = new Mail(from, subject, to, content);

request.method = Method.POST;
request.endpoint = "mail/send";
request.body = mail.build();
Response response = sg.api(request);

I tried curl command with multi-byte, it worked fine. The result means issue on library side.

Technical details:

  • java-http-client Version: 2.3.1
  • sendgrid-java Version:3.0.2
  • Java Version: JDK 8u66

Create first time contributor documentation

Issue Summary

Our open sourced documentation has a great first time contributor page that we wish to duplicate here.

Acceptance Criteria

  • We have a file in the root directory called first-timers.md or similar that helps a first time contributor make their first PR (please use our CONTRIBUTOR.md file for inspiration as well as this page)
  • We provide a link to tasks with the labels "difficulty: easy" and "status: help wanted" (example query) to all the repos listed here, please scroll to the bottom.

Implement auto-deploy to package manager

Issue Summary

When all tests on the master branch pass in Travis CI, we would like to auto-deploy the release to the package manager.

Before writing any code, we suggest you review our CONTRIBUTING.md file and propose your solution for discussion here in the comments. Thank you!

Aceptance Criteria

  • when Travis CI passes all tests on the master branch we auto-deploy to the package manager
  • the version is determined by the CHANGELOG.md

Improve Error Handling

In The Client you use BasicResponseHandler to handle the response.
The problem is that when the status code is >= 300 HttpResponseException is thrown, ignoring the response body.
In Sendgrid v3 web API all the details of the failure are in the response body.
so when there is a failure, you have no information about what caused the problem.

You should either insert the response body to the exception message or return your Response even if the status code is >=300 (I think the second option is better).

Store HTTP headers in case-insensitive map

Issue Summary

While creating Response object the library puts all headers in java.util.HashMap which is case-sensitive (see: https://github.com/sendgrid/java-http-client/blob/main/src/main/java/com/sendgrid/Client.java#L163). It works fine when nothing messes up with headers. But when, for example, Istio sidecar is running along the application that uses SendGrid envoy proxy lower-cases all HTTP headers (e.g. X-Message-Id becomes x-message-id). In order to keep things working one has to manually write logic for looking both X-Message-Id and x-message-id which is rather inconvenient. Having headers stored in something like java.util.TreeMap with String.CASE_INSENSITIVE_ORDER comparator would make work with headers much easier.

Steps to Reproduce

Run SendGrid application along with something that manipulates headers (e.g. makes all of them lower-case).

Technical details:

  • java-http-client version: 4.3.6
  • java version: OpenJDK 11

Error when sending an email through SendGrid API on android 6 project

Issue Summary

SendGrid doesn't work on android Level 23+ because HttpClient of Apache which one java-http-client has based on, has been removed from Android 6.

Steps to Reproduce

  1. Have an android 6 project
  2. Import sendgrid-java:4.3.0
  3. Try to send an email through Sendgrid API
  4. You get an error in SendGrid constructor

Details of error :
java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes3.dex)

Technical details:

  • java-http-client Version: master (latest commit: 4.2.0)
  • Java Version: 1.8

Allow a timeout value to be set

These values should be configurable

.setSocketTimeout(timeout)
.setConnectTimeout(timeout)
.setConnectionRequestTimeout(timeout)

Add unittest to check for specific repo files

This repo should have the following list of files included:

  • ./Docker or docker/Docker
  • ./docker-compose.yml or ./docker/docker-compose.yml
  • ./.env_sample
  • ./.gitignore
  • ./.travis.yml
  • ./.codeclimate.yml
  • ./CHANGELOG.md
  • ./CODE_OF_CONDUCT.md
  • ./CONTRIBUTING.md
  • ./.github/ISSUE_TEMPLATE
  • ./LICENSE.md
  • ./.github/PULL_REQUEST_TEMPLATE
  • ./README.md
  • ./TROUBLESHOOTING.md
  • ./USAGE.md
  • ./USE_CASES.md

This PR is only asking for tests of the existence of these files, if the files do not exist when you run the tests - do not worry about the tests not passing. We will identify this and create a new PR for the issue.
Thank you!

JDK 9 support

Issue Summary

The Sendgrid Java Http Client dependency on version 1.10.19 of mockito-core leads to the following warning when running a Scala project using JDK 9:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.mockito.cglib.core.ReflectUtils$2 (file:/home/petrova/.ivy2/cache/org.mockito/mockito-core/jars/mockito-core-1.10.19.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.mockito.cglib.core.ReflectUtils$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

I assume pure Java 9 projects would have a similar issue.

As mentioned in this issue, the warning can be avoided by upgrading to mockito version 2.13.0.

Steps to Reproduce

  1. Run tests for project which make use of the Sendgrid Java HTTP client
  2. Receive the following warning in the terminal

Expectations: Not to see the warning.

Technical details:

  • java-http-client Version: 4.1.0 (as the dependency is pulled in from sendgrid-java, which has not yet upgraded to 4.2.0). (I can also open up an issue over there if that is helpful).
  • Java Version: 9

Let me know if there is any other information I can provide which would be useful!

Add a unittest to check the license.md file date range

The end year in the license file should be "this year" and this should be checked on every run of the tests. If the end year is no correct, fail the test.
example:

Copyright (c) 2012-2016 SendGrid, Inc.
It is 2017, so this should be:
Copyright (c) 2012-2017 SendGrid, Inc.
and the test should fail.
--done

Add a .env_sample file

Our preference is that users have an environment file when using the SendGrid API, because it is less likely that someone would commit their credentials to github.

Please make a couple changes:

  • make a .env_sample file that contains: export SENDGRID_API_KEY=''
  • make (or add) a .gitignore file and include .env
  • add instructions to the README file about how to copy .env_sample to .env and add the API Key

Auto-generate the release notes upon release

Issue Summary

For every release, we hand craft the release notes on GitHub, now we would like to automate this process. Please see the existing release notes for an example. The contents of the release notes are generated from the CHANGELOG.md file. Here is the documentation for updating the release notes via the GitHub API.

Acceptance Criteria

  • A script, which when run, creates a release note update based on the last deployed release

Stats for multiple categories in one API call

Issue Summary

Sendgrid API v3 Reference for categories/stats endpoints states that API call can be made to get stats for upto 10 categories.
However, it does not provide any reference for how to make that API call. I checked the code for addQueryParam here
https://github.com/sendgrid/java-http-client/blob/main/src/main/java/com/sendgrid/Request.java
which takes categories as only key-value pair. How are we supposed to pass "upto 10 categories"?

Steps to Reproduce

  1. Use categories/stats endpoint to get stats for 10 categories in the same API call.

Code Snippet

# paste code here

request.setMethod(Method.GET);
request.setEndpoint("categories/stats");

request.addQueryParam("categories", "qa2");   //how to pass multiple categories here

### Exception/Log

paste exception/log here


### Technical details:
* java-http-client version: Sendgrid 4.6.4
* java version: JDK 14

Auto-generate the CHANGELOG.md file upon release

Issue Summary

For every release, we currently hand craft a CHANGELOG.md update, now we would like to automate this process. Please see the existing CHANGELOG.md for formatting structure.

Acceptance Criteria

  • A script, which when run, creates a CHANGELOG.md update based on any merged PRs since the last release.

Unable to test under Java 11

Issue Summary

Although java-http-client compiles just fine with the Java 11 JDK, maven is unable to run the test command because of a dependency on an inappropriate version of the jacoco-maven-plugin. Bringing this dependency current will allow testing on Java 11 as well as all previous JDKs.

Steps to Reproduce

  1. Make sure maven is using a Java 11 JDK
  2. mvn test

I expect to be able to compile and test java-http-client no matter what version of the JDK is used.

Technical details:

  • java-http-client Version: 4.1.0
  • Java Version: 11

404 not found at LICENSE link from README.md

Issue Summary

Clicking on the License badge or license link at the bottom from README.md gives 404 error.

Steps to Reproduce

Click on license badge or license link from README.md

Technical details:

LICENSE file was renamed to LICENSE.md from LICENSE.txt

Add a USAGE.md file

Usage files are really nice when they exist in a repo, because it makes it really obvious where to look for information about how to use this tool. It can be frustrating when you expect this file to be there and it's not.
Please add a USAGE.md file, you can see an example of this
here

Please make sure you modify the file for this repo (hint: Most of this information should be in the README file)

Update .md files for SEO-ness

We received an awesome PR for #hacktoberfest on our ruby library
We would love to see the same thing on the README in this repo as well.
Please replace the "-" with "_" in README, CONTRIBUTING, USE_CASES, USAGE files.

Thanks and happy Hacktoberfest!!

Replace Httpcore dependency

Issue Summary

Because sendgrid/java-http-client depends on org.apache.httpcomponents/httpcore, this library is necessary under google appengine in order to stay under socket connection quotas:
https://github.com/sendgrid/sendgrid-google-java

But it looks like that library is soon to be very out of date with the latest sendgrid apis. It would be great if java-http-client could remove that dependency and just use the built in java http connection apis directly so that the official sendgrid-java library would work in all scenarios.

Bring Apache HttpComponents dependencies current

Issue Summary

java-http-client 4.1.0 currently depends on org.apache.httpcomponents:httpcore:4.4.4, upgrade this to 4.4.12. It also depends on org.apache.httpcomponents:httpclient:4.5.2, upgrade this to 4.5.10.

This reduces enforcer violations when combined with any of the popular libraries that also depend upon httpcomponents (e.g., aws-java-sdk), and makes it easier to compile/use with Java 11.

Technical details:

  • java-http-client Version: 4.1.0
  • Java Version: 1.8

Create a Use Cases Directory

Due to the success we have seen from hacktoberfest, we are seeing more people create use cases. This is amazing!
We want to make sure that everyone can find them. Please help us to break up this file and make it easier to read and manage:

  • Create a Use Cases Directory
  • Put a README.md in this directory
  • Make a file in the new directory for each individual Use Case from USE_CASES.md, copy the content to this file
  • For each file you've created, link to it from the README you created
  • Organize the links in the README by type
  • Make sure the names of the files you created are related to the Use Case
    Thank you!

Update the Request object with sensible defaults and access methods

Issue Summary

In the Request we have:

public Map<String,String> headers;
public Map<String,String> queryParams;

set to null when the object gets instantiated.

This could definitely cause JAVA developer errors as they might assume the headers map to be at least instantiated and empty.

In fact in this example:

Map<String,String> requestHeaders = new HashMap<String, String>();
requestHeaders.put("Authorization", "Bearer YOUR_API_KEY");
request.headers = requestHeaders;

The user is forced to instantiate a new one and assign it while the developer could simply:
request.headers.put("Authorization","Bearer YOUR_API_KEY");

When playing with beans (such as Request), if you can avoid referencing externally complex objects it is better. In fact, I would suggest you to turn them private (or protected), add getters and setters, initialize them, and even make them final.

Add a .codeclimate.yml file to this repo

It is possible to configure how CodeClimate looks at a repository.
These Docs explain how this is done. Please create an appropriate .codeclimate.yml for this repo. It should test the main language of the repo and run tests.

Document new Git workflow in CHANGELOG.md

Issue Summary

We want to update our git workflow to function more like Gitflow. We need to update the CONTRIBUTING.md file and PULL_REQUEST_TEMPLATE to direct contributors to fork/branch off the development branch and to merge their PRs with the development branch. Once this issue is complete, we will be creating the development branch and making that branch the default. This is part of a larger strategy to execute releases for this SDK on a predictable cadence.

Acceptance Criteria

  • Update CONTRIBUTING.md documentation, explaining the process of forking and branching off the development branch and submitting PRs agains the development branch.
  • Update PULL_REQUEST_TEMPLATE with the same addition to the CONTRIBUTING.md documentation.

Attachment Name does not show Norwegian Characters

Issue Summary

I am new to SendGrid, I wanted to send a mail with attachment having Norwegian characters in the name. Receiver is receiving the mail but the name contains Å instead of Ø. Saw the Client class , it contains the change for UTF characters

sendgrid-java v3.1.0 is being used. Not using the java-http-client. I visited few related issues but was not able to get which api version include this change. Its urgent for me as we are going in production in two weeks.

Please help!

mockito-core runtime dependency

Issue Summary

The current build.gradle configuration specifies mockito-core has a runtime dependency as opposed to the pom.xml which includes it as a test dependency.

You seem to be using Gradle for publishing since the current 4.0.0 version dependency tree has mockito-core scoped to runtime.
Is this expected or should it be scoped to test?

Technical details:

  • java-http-client Version: master and 4.0.0 at least

Request cannot send utf_8 charset when the body is not null

Issue Summary

I try to use the sendgrid template and I set the personalization, but one value like this : "Irène" this is word using utf-8 charset. I have set headers
requestHeaders.put("Content-Type", "application/json; charset=utf-8");
request.headers = requestHeaders;
But the return is : org.apache.http.client.HttpResponseException: Unsupported Media Type

I use sendgrid 2.2.2 is ok.

So I check the client.java and find you set the
content_type : "application/json" when the body is not null.

Steps to Reproduce

Could you check the headers if there exists the content_type, don't set the content-type automatically?
or you tell me how to sovle this problem ?

Thank you.

Technical details:

  • java-http-client Version: master (latest commit: [commit number])
  • Node.js Version: 1.7.0_60

Hacktoberfest: SendGrid Current Status

SendGrid DX team current status:

  • Wow
  • OMG
  • THANK YOU

Hacktoberfest 2017 has completely blown us away. We have had over 900 pull requests from over 300 contributors all in the last 30 days. That is more PRs than we normally get in 2 years!
We are actively working to review, comment, and/or merge as many PRs as we possibly can as quickly as we can.

We are currently working on “intaking” all the PRs that have come in, oldest first (we have about 400 remaining to go through). We are making sure that each PR we review is one we have a chance of merging - there have been a couple spammy items that came through. Due to the massive influx of requests so far, @thinkingserious and @mbernier have been working nights and weekends all month just to keep up! We’re not even mad, this is amazing!

Hey, that’s great for you - but what about my shirt!

If you have signed the CLA before 11/1, but haven’t had a PR merged yet, do not despair! We know we are behind on even just commenting on every PR to show you that we received it (something we typically do). If you submitted a mergeable (non-spam, actually adds value to the project) PR during October 2017, we will grant access to this page to redeem your shirt, sticker, and hacker pin. Next year, we will be sure to communicate this information sooner. We are sorry for any confusion we have caused. We appreciate those of you who have reached out to find out what’s going on!

What can I do to help move things along?

Have you signed the CLA yet?
We can only merge items from contributors who signed the CLA

Can you help another contributor?
If you can identify potential problems, add suggestions, or even leave a comment with your review of another PR (Looks good to me! Or I approve this change), that would help us review those PRs much faster, making it easier to get to your PR.

Do you even write tests, friend?
If you see a place where we could have a test to validate a piece of functionality, add it in. We know We know! It’s just another PR we have to review and merge. You’re right, it is! However, the more tests we have, the earlier our CI tool can catch issues, saving us a review as well as back and forth time.

@andy-trimble, @ayushkalani, @chinurox, @dhsrocha, @huytranrjc, @lanre01, @mbernier, @mithunsasidharan, @Nikhil2508, @pushkyn, @rkaranam, @thepriefy, @tsuyoshizawa

Class not found SendGridResponseHandler

Issue Summary

I am getting classnotFound: SendgridResponseHandler, sometimes I am getting java.lang.ClassNotFoundException: org.apache.http.impl.client.AbstractResponseHandler but the mail is being sent. While fetching the response data , it is giving this error. I suppose some mismatch of jar versions.

Technical details:

  • java-http-client Version: 4.1.0
  • Java Version: 1.7
  • SendGrid-java : 3.1.0

When creating a `new Client` allow suppling both underlying client and isTest parameter

Issue Summary

I want to supply an underlying HTTP Client to be able to set a timeout and as well set the test property.

Currently, these are the constructors exists-
public Client()
public Client(CloseableHttpClient httpClient)
public Client(Boolean test)

I will add another constructor that gets these two parameters.

Seems that the intention of passing the http was for mocking but another use case is to be able to set up the http client (for example set up timeout).

Java docker container

Issue Summary

It is really nice to be able to develop locally inside a docker container! Please dockerize this repo!

  • You can probably use the Dockerfile for sendgrid-java
  • Please setup docker-compose to use a local volume for the library files (this is currently different from sendgrid-java)
  • Please add information to the README and USAGE files about how to startup the container

Clean up Usage in README

Issue Summary

Move the example and the link to the examples files to the USAGE.md File
Move the Environment variable information to USAGE.md
Remove the Usage Header from README
Change the link in the Table of Contents of README to go to USAGE.md File

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.