如何在Elm中为http get请求编写测试

问题描述

我正在尝试检查发送请求后收到的数据,为此,我需要编写一个测试来确保这一点。

这是处理数据的三个功能。

fetchConfigs : Cmd Msg
fetchConfigs =
Http.get
  { url = "http://localhost:8080/api/sso/configs",expect = Http.expectJson GotConfigs responseDecoder
  }


responseDecoder : Decoder Config
responseDecoder =
    map2 Config
        (field "identifier" string)
        (field "ssoType" int)

type Msg
    = GotConfigs (Result Http.Error Config)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)