According to express interface, the request.ip property must be always defined, so I have set 127.0.0.1 as the default value.
Additionally, I have also implemented the request.ips property.
Note:
Formally request.ip is defined as request.ips[0] but I made the decision to simplify the RequestOptions interface accepting only the ip property because it is the common case and it avoids inconsistencies between both options (when someone specifies an ip that is not the first element of ips).
Changes:
According to
express
interface, therequest.ip
property must be always defined, so I have set127.0.0.1
as the default value.Additionally, I have also implemented the
request.ips
property.Note:
Formally
request.ip
is defined asrequest.ips[0]
but I made the decision to simplify theRequestOptions
interface accepting only theip
property because it is the common case and it avoids inconsistencies between both options (when someone specifies anip
that is not the first element ofips
).