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

NumberFetcher is double encoding the number #793

Open
paulotaylor opened this issue Apr 30, 2024 · 1 comment
Open

NumberFetcher is double encoding the number #793

paulotaylor opened this issue Apr 30, 2024 · 1 comment

Comments

@paulotaylor
Copy link

Issue Summary

com.twilio.rest.pricing.v2.voice.NumberFetcher is double encoding de number
If I use the number +15017122661 we can see in the logs that it's trying to fetch %252B15017122661 which is the number +15017122661 url encoded twice
As seen in the logs: request URL: https://pricing.twilio.com/v2/Voice/Numbers/%252B15017122661

Steps to Reproduce

Happens all the time when trying to fetch number pricing

Code Snippet

Number result = Number.fetcher(new PhoneNumber("+15017122661")).fetch();

Exception/Log

2024-04-30T15:04:35.310+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : -- BEGIN Twilio API Request --
2024-04-30T15:04:35.310+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : request method: GET
2024-04-30T15:04:35.310+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : request URL: https://pricing.twilio.com/v2/Voice/Numbers/%252B15017122661
2024-04-30T15:04:35.310+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : -- END Twilio API Request --
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : status code: 404
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : response headers:
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Date: Tue, 30 Apr 2024 14:04:35 GMT
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Content-Type: application/json
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Content-Length: 168
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Connection: keep-alive
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Access-Control-Allow-Origin: *
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Access-Control-Allow-Headers: Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, Idempotency-Key
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Access-Control-Allow-Credentials: true
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Access-Control-Allow-Methods: GET, POST, DELETE, OPTIONS
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Access-Control-Expose-Headers: ETag
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Twilio-Request-Id: RQ408349452393e60ea717e057c804fe81
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Twilio-Request-Duration: 0.012
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: Twilio-Concurrent-Requests: 1
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: X-Shenanigans: none
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: X-Powered-By: AT-5000
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: X-Home-Region: us1
2024-04-30T15:04:35.957+01:00 DEBUG 33882 --- [nio-8080-exec-3] com.twilio.http.TwilioRestClient         : responseHeader: X-API-Domain: pricing.twilio.com

Technical details:

  • twilio-java version: 10.1.5
  • java version: Java correto 18.0.2
@tiwarishubham635
Copy link
Contributor

I have reproduced this issue. The encoding is happening at two places:

  1. First one here at the API level
  2. Second one here at the request level

I can look into this and see if we can remove one of them. Thanks for pointing out.

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

No branches or pull requests

2 participants