gojek / heimdall

An enhanced HTTP client for Go
http://gojek.tech
Apache License 2.0
2.61k stars 215 forks source link

Hystrix Client Exit on Hystrix Time-out Error #132

Open vaguecoder opened 2 years ago

vaguecoder commented 2 years ago

Motivation

Issue #127 reported by @sebastian-popa

Changes

  1. Condition to verify hystrix-timeout error and exit w/o retry. Add unit test to verify the same.
  2. Upgrade version of testify package: v1.3.0 -> v1.7.0 for assert.ErrorIs used by the same unit test.

Summary

Heimdall's hystrix-client once timed out on hystrix-go's client, the subsequent retries fail by throwing error similar to http: ContentLength=24 with Body length 0 as reported in #127. The code on #127 polished and shared at playground link to understand this.

cURL Call:

curl 'http://localhost:8080/proxy' -d'{"message": "anything"}'

Results:

# Before
{"message":"Post \"http://localhost:8080/actual\": http: ContentLength=24 with Body length 0"}

# Now
{"message":"hystrix: timeout"}

Related Issues

Closes #127