尝试去测试触发 POST 请求的 Web 组装功能。
收到以下错误:
firePing_test.go:40: ERROR ON POST REQUEST: Post https://not-the-real-api.execute-api.us-east-1.amazonaws.com/testing: dial tcp: Protocol not available
Run Code Online (Sandbox Code Playgroud)
运行:Ubuntu 18.04.2 LTS go版本go1.12.2 linux/amd64
我已经测试过该函数是有效的,并且在chrome中执行时会发送请求。为 linux/amd64 编译时测试也通过。
问题函数:
firePing_test.go:40: ERROR ON POST REQUEST: Post https://not-the-real-api.execute-api.us-east-1.amazonaws.com/testing: dial tcp: Protocol not available
Run Code Online (Sandbox Code Playgroud)
问题测试函数调用:
// FirePing fires a ping
func FirePing(protocol *string, domain *string, params *map[string]string) (*http.Response, error) {
// Marshal map into POST request body
reqBody, err := json.Marshal(*params)
if err != nil {
return nil, fmt.Errorf("ERROR ON MARSHAL OF PARAMS: %v", err) …Run Code Online (Sandbox Code Playgroud)