Skip to content

@http_adapter doesn't work reliably #8

@Sgoettschkes

Description

@Sgoettschkes

I'm working with the 1.0.0. branch!

The module attribute @http_adapter in the Intercom.API.Request module doesn't work reliably for me. Using iex -S mix to get into the elixir repl, @http_adapter is nil even though Application.get_env(:intercom, :http_adapter) does return the correct value. I'm getting the following error:

** (UndefinedFunctionError) function nil.post/4 is undefined
    nil.post("https://api.intercom.io/users", "{\"custom_attributes\":{\"is_hcp\":true,\"occupation\":\"other\",\"real_country\":\"at\",\"real_first_name\":\"test\",\"real_gender\":\"male\",\"real_last_name\":\"test\",\"real_title\":\"test\",\"real_zip\":\"1060\",\"speciality\":\"\"},\"email\":\"[email protected]\",\"id\":1,\"name\":\"\",\"signed_up_at\":1579171202}", [Authorization: "Bearer dG9rOmMxODQ5MGRlXzQ1NmFfNGE3Ml9hYjJiXzE3Nzc3MDFlNzRiYjoxOjA=", Accept: "application/json", "Content-Type": "application/json"], [])
    (intercom) lib/intercom/api/request.ex:11: Intercom.API.Request.make_request/4
    (intercom) lib/intercom/api.ex:28: Intercom.API.call_endpoint/3

Changing the module to either use HTTPPoison directly or instead of using @http_adaptercalling the following function works:

defp http_adapter() do
    Application.get_env(:intercom, :http_adapter)
  end

I'm not sure what's the best approach to reading modules from the config is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions