How to test http calls in Go using httptest

后端 未结 3 1774
北恋
北恋 2020-12-04 06:09

I have the following code:

package main

import (
    \"encoding/json\"
    \"fmt\"
    \"io/ioutil\"
    \"log\"
    \"net/http\"
    \"time\"
)

type twitt         


        
3条回答
  •  醉梦人生
    2020-12-04 07:08

    Originally this code snippet was found on GitHub Gist, but while trying to apply the concept to one of my projects I realized that I had to modify the main code significantly that I decided to test these calls using an integration test by using docker and curl.

提交回复
热议问题