Closed bettinson closed 2 years ago
Describe the bug Type mismatch for Socket::UNIXAddress
Socket::UNIXAddress
To Reproduce ip_address = context.request.remote_address.try(&.address) || "N/A"
ip_address = context.request.remote_address.try(&.address) || "N/A"
from https://luckyframework.org/guides/http-and-routing/http-handlers#remoteiphandler
Screenshots/code
Error: undefined method 'address' for Socket::UNIXAddress (compile-time type is Socket::Address+)
Fix
ip_address = context.request.remote_address.as(Socket::IPAddress).try(&.address) || "N/A"
Versions (please complete the following information):
Yeah, I feel like we should be able to update the handler to better handle this. You shouldn't have to do all the guessing and stuff with it
https://github.com/luckyframework/lucky/blob/08a70e191b6a242cdf972750219dc732e2d5ec16/src/lucky/remote_ip_handler.cr#L10-L32
Describe the bug Type mismatch for
Socket::UNIXAddress
To Reproduce
ip_address = context.request.remote_address.try(&.address) || "N/A"
from https://luckyframework.org/guides/http-and-routing/http-handlers#remoteiphandler
Screenshots/code
Fix
ip_address = context.request.remote_address.as(Socket::IPAddress).try(&.address) || "N/A"
Versions (please complete the following information):