rsocket / rsocket-go

rsocket-go implementation
Apache License 2.0
511 stars 46 forks source link

Check for nil resp before using resp.Status after DialContext error #109

Closed ronakg closed 3 years ago

ronakg commented 3 years ago

Check for nil resp before using resp.Status after DialContext error

Motivation:

This is a follow-up to the last PR https://github.com/rsocket/rsocket-go/pull/108. Turns out gorilla DialContext can return a nil response in some cases. If so, resp.Status panics of course.

Modifications:

Check for non nil resp before using resp.Status.

Result:

HTTP response status is included in the error only if there's a non nil response from DialContext.

codecov-commenter commented 3 years ago

Codecov Report

Merging #109 (531e46d) into master (8cd57e4) will decrease coverage by 0.10%. The diff coverage is 0.00%.

:exclamation: Current head 531e46d differs from pull request most recent head 3050184. Consider uploading reports for the commit 3050184 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master     #109      +/-   ##
==========================================
- Coverage   62.67%   62.56%   -0.11%     
==========================================
  Files         100      100              
  Lines        4525     4528       +3     
==========================================
- Hits         2836     2833       -3     
- Misses       1415     1418       +3     
- Partials      274      277       +3     
Impacted Files Coverage Δ
core/transport/websocket_transport.go 37.11% <0.00%> (-3.32%) :arrow_down:
core/transport/transport.go 83.44% <0.00%> (-1.33%) :arrow_down:
server.go 70.78% <0.00%> (+0.56%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8cd57e4...3050184. Read the comment docs.

jjeffcaii commented 3 years ago

Released with v0.8.4.