// Create a request which is set headers for Parse API func (s *ParseSession) initRequest(req *gorequest.SuperAgent, useMaster bool) { if useMaster { req. Set(headerAppID, s.client.ApplicationID). Set(headerMasterKey, s.client.MasterKey). Timeout(s.client.TimeOut) } else { req. Set(headerAppID, s.client.ApplicationID). Set(headerAPIKey, s.client.RESTAPIKey). Timeout(s.client.TimeOut) } if s.SessionToken != "" { req.Set(headerSessionToken, s.SessionToken) } }
func getRequest(job models.Job) *gorequest.SuperAgent { var request = gorequest.New() var r *gorequest.SuperAgent if job.HTTPVerb == gorequest.GET { r = request.Get(job.URI) } if job.HTTPVerb == gorequest.POST { r = request.Post(job.URI) } r.Timeout(time.Second * 20) for key, header := range job.Headers { r.Set(key, interfaceToString(header)) } return r }
func setHeadersFromMock(req *gorequest.SuperAgent, mock Mock) { for header, val := range mock.HttpRequest.Headers { req.Set(header, val) } }