I'm working with a test in which I need to hit a service I'm running locally. The service is a rails application with a JSON api exposed. It's running on port 3000. When I execute this elixir code I get an error:
json_event = <some valid json built earlier>
my_url = "http://localhost:3000/api/service_call"
response = HTTPoison.post(my_url, json_event)
The error I get is:
{:error, %HTTPoison.Error{id: nil, reason: :econnrefused}}
I should note that there is no output found in the service log when I execute that code.
my question is can the port be specified, and if so have I done so correctly by simply building it into the url?
I guess a follow on question would be what are the reasons that I might get this :econnrefused error?
I'm not even sure I'm asking the RIGHT questions :P
thanks
So two parts to the answer here:
Yes, you can specify port, and you can do it by simply putting it into the URL itself. For example, http://localhost:3000/api/service_call.
rebooting fixed whatever was wrong with my system. I have no idea why it made a difference.