// Make records the request and the response to UI
196029
func (logger *RequestLogger) Make(request *http.Request, passedResponse *uaa.Response) error {
	err := logger.displayRequest(request)
	if err != nil {
		logger.output.HandleInternalError(err)
	}

	err = logger.connection.Make(request, passedResponse)

	if passedResponse.HTTPResponse != nil {
		displayErr := logger.displayResponse(passedResponse)
		if displayErr != nil {
			logger.output.HandleInternalError(displayErr)
		}
	}

	return err
}
5279
func (api *API) makeRequest(method, uri string, params interface{}) ([]byte, error) {
	return api.makeRequestWithAuthType(context.TODO(), method, uri, params, api.authType)
}
538627
func makeParams(action string) map[string]string {
	params := make(map[string]string)
	params[ActionKey] = action
	return params
}
109876
func (mr *MockServiceInterfaceMockRecorder) Create(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockServiceInterface)(nil).Create), arg0)
}
985081
func (mem *Memory) Create(key string, rls *rspb.Release) error {
	defer unlock(mem.wlock())

	if recs, ok := mem.cache[rls.Name]; ok {
		if err := recs.Add(newRecord(key, rls)); err != nil {
			return err
		}
		mem.cache[rls.Name] = recs
		return nil
	}
	mem.cache[rls.Name] = records{newRecord(key, rls)}
	return nil
}
144477
func makeCtx(req *http.Request, w http.ResponseWriter) *Ctx {
	request := makeRequest(req)
	response := makeResponse(req, w)
	// 404 - OK by default
	// this can be overided by middlewares and handler fns
	response.Status = 404

	ctx := &Ctx{
		Req:    request,
		Res:    response,
		Data:   CtxData{},
		Errors: []error{},
	}
	ctx.InitEBus()

	return ctx
}
172876
func (r *Request) Do() *Response {
	if r.err != nil {
		return &Response{
			err: r.err,
		}
	}

	req, err := r.request()
	if err != nil {
		return &Response{
			err: err,
		}
	}

	res, err := r.client.Do(req)
	if err != nil {
		return &Response{
			err: err,
		}
	}

	// return res, err
	return newResponse(res, err)
}
705197
func Do(req *http.Request) (resp *http.Response, err error) {
	c := New()
	return c.Do(req)
}
1330063
func MakeRequestAsync(request rest.Request) (chan *rest.Response, chan error) {
	r := make(chan *rest.Response)
	e := make(chan error)

	go func() {
		response, err := MakeRequestRetry(request)
		if err != nil {
			e <- err
		}
		if response != nil {
			r <- response
		}
	}()

	return r, e
}
1049677
func (c *Client) do(method, path string, ct contentType, body ...[]byte) (*rbody.APIResponse, error) {
	var (
		rsp *http.Response
		err error
		req *http.Request
	)
	switch method {
	case "GET":
		req, err = http.NewRequest(method, c.prefix+path, nil)
		if err != nil {
			return nil, err
		}
		addAuth(req, c.Username, c.Password)
		rsp, err = c.http.Do(req)
		if err != nil {
			if strings.Contains(err.Error(), "tls: oversized record") || strings.Contains(err.Error(), "malformed HTTP response") {
				return nil, fmt.Errorf("error connecting to API URI: %s. Do you have an http/https mismatch?", c.URL)
			}
			return nil, fmt.Errorf("URL target is not available. %v", err)
		}
		defer rsp.Body.Close()
	case "PUT":
		var b *bytes.Reader
		if len(body) == 0 {
			b = bytes.NewReader([]byte{})
		} else {
			b = bytes.NewReader(body[0])
		}
		req, err = http.NewRequest(method, c.prefix+path, b)
		if err != nil {
			return nil, fmt.Errorf("URL target is not available. %v", err)
		}
		addAuth(req, c.Username, c.Password)
		req.Header.Add("Content-Type", ct.String())

		rsp, err = c.http.Do(req)
		if err != nil {
			if strings.Contains(err.Error(), "tls: oversized record") || strings.Contains(err.Error(), "malformed HTTP response") {
				return nil, fmt.Errorf("error connecting to API URI: %s. Do you have an http/https mismatch?", c.URL)
			}
			return nil, fmt.Errorf("URL target is not available. %v", err)
		}
		defer rsp.Body.Close()
	case "DELETE":
		var b *bytes.Reader
		if len(body) == 0 {
			b = bytes.NewReader([]byte{})
		} else {
			b = bytes.NewReader(body[0])
		}

		req, err = http.NewRequest(method, c.prefix+path, b)
		if err != nil {
			return nil, fmt.Errorf("URL target is not available. %v", err)
		}
		addAuth(req, c.Username, c.Password)
		req.Header.Add("Content-Type", "application/json")
		rsp, err = c.http.Do(req)
		if err != nil {
			if strings.Contains(err.Error(), "tls: oversized record") || strings.Contains(err.Error(), "malformed HTTP response") {
				return nil, fmt.Errorf("error connecting to API URI: %s. Do you have an http/https mismatch?", c.URL)
			}
			return nil, fmt.Errorf("URL target is not available. %v", err)
		}
		defer rsp.Body.Close()
	case "POST":
		var b *bytes.Reader
		if len(body) == 0 {
			b = bytes.NewReader([]byte{})
		} else {
			b = bytes.NewReader(body[0])
		}
		req, err = http.NewRequest(method, c.prefix+path, b)
		if err != nil {
			return nil, err
		}
		addAuth(req, c.Username, c.Password)
		req.Header.Add("Content-Type", ct.String())
		rsp, err = c.http.Do(req)
		if err != nil {
			if strings.Contains(err.Error(), "tls: oversized record") || strings.Contains(err.Error(), "malformed HTTP response") {
				return nil, fmt.Errorf("error connecting to API URI: %s. Do you have an http/https mismatch?", c.URL)
			}
			return nil, fmt.Errorf("URL target is not available. %v", err)
		}
		defer rsp.Body.Close()
	}
	return httpRespToAPIResp(rsp)
}
540763
func (m *Mux) Build(handlers []Handler) (http.Handler, error) {
	recordMap := make(map[string][]Record)
	for _, h := range handlers {
		recordMap[h.Method] = append(recordMap[h.Method], NewRecord(h.Path, h.Func))
	}
	mux := newServeMux()
	for m, records := range recordMap {
		router := New()
		if err := router.Build(records); err != nil {
			return nil, err
		}
		mux.routers[m] = router
	}
	return mux, nil
}
1099098
func (records *Records) Create(ctx context.Context, record *Record) (err error) {
	buffer := new(bytes.Buffer)
	err = json.NewEncoder(buffer).Encode(record)
	if err != nil {
		return
	}
	response, err := httpDo(ctx, records.Options, "POST", apiURL("/zones/%s/dns_records", record.ZoneID), buffer)
	if err != nil {
		return
	}
	defer response.Body.Close()
	result, err := readResponse(response.Body)
	if err != nil {
		return
	}
	res := new(Record)
	err = json.Unmarshal(result.Result, &res)
	if err != nil {
		return
	}
	record.ID = res.ID
	record.TTL = res.TTL
	record.Locked = res.Locked
	record.Proxied = res.Proxied
	record.Proxiable = res.Proxiable
	record.CreatedOn = res.CreatedOn
	record.ModifiedOn = res.ModifiedOn
	return
}
147629
func (mr *MockManagerMockRecorder) Create(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockManager)(nil).Create), arg0, arg1, arg2, arg3, arg4, arg5)
}
348838
func makeRequest(req *http.Request) *Request {
	request := &Request{
		Request: req,
	}

	return request
}
1069915
func (s *Source) Record() (rec interface{}, err error) {
	var res map[string]interface{}
	err = s.dec.Decode(&res)
	if err != nil {
		return nil, err
	}
	return res, nil
}
841685
func (m *Manager) makeRequest(op managerOp) error {
	request := managerRequest{
		op:       op,
		response: make(chan error),
	}
	m.requests <- request
	return <-request.response
}
630603
func (p Protos) makeRequest(req *http.Request) ([]byte, error) {
	req.Header.Set("Appid", p.AppID)

	resp, err := p.HTTPclient.Do(req)
	if err != nil {
		return []byte{}, err
	}
	defer resp.Body.Close()

	payload, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return []byte{}, err
	}

	if resp.StatusCode != 200 {
		httperr := httpErr{}
		err := json.Unmarshal(payload, &httperr)
		if err != nil {
			return []byte{}, fmt.Errorf("Failed to decode error message from Protos: %s", err.Error())
		}
		return []byte{}, errors.New(httperr.Error)
	}

	return payload, nil
}