I'm using appengine and golang to develop simple RESTful APIs. The code works fine when I start service using goapp serve, and I started writing the unit test functions to test the API endpoints, and I'm struck here with the panic error appengine: NewContext passed an unknown http.Request
. I'm getting this error when i run goapp test
.
It looks like for some reason, i'm not able to pass the request that I created and pass it to appengine.NewContext()
Below is the snippet of the code..
body := strings.NewReader("")
request, err := http.NewRequest("GET", "endpoint url", body) //inst.NewRequest("GET", goalUrl, body) //
if err != nil {
t.Error(err)
}
t.Log(request)
c := appengine.NewContext(request) // ERROR: appengine: NewContext passed an unknown http.Request
I have created a simple reproducible code. Can you help me with this? or Does anyone have their golang API project on appengine, and have unit test functions to test the endpoints, i'll like to take a look at their code...
Here is the gitlab issue that I posted, which has all the required details of the issue along with examples and detailed error message. Thank for all your help.