gaffneyc / usps

USPS Webtools API for Ruby
MIT License
63 stars 54 forks source link

Timeout issue #23

Closed lanzhiheng closed 3 years ago

lanzhiheng commented 6 years ago

When we send a Timeout request, we will get empty response body

 response = Typhoeus::Request.get(server, {
        :timeout => USPS.config.timeout,
        :params => {
          "API" => request.api,
          "XML" => request.build
        }
      })

response.body # => ""

So, when I send the request to verify the address it will not raise error with the error address. We probably get different result by the same request. Sometimes will raise AddressNotFoundError and sometimes will not get any feedback.

I think it will be better to raise the TimeoutError, when the request timeout.