func (c *Client) NewRequest(method, path string, query *url.Values, body interface{}, proxied bool) (*http.Request, string, error) {
	requestID := uuid.NewV4().String()

	b := &bytes.Buffer{}
	if body != nil {
		enc := json.NewEncoder(b)
		err := enc.Encode(body)
		if err != nil {
			return nil, requestID, err
		}
	}

	if query == nil {
		query = &url.Values{}
	}

	version := "v1"
	if proxied {
		version = "proxy"
	}

	fullPath := "http://localhost/" + version + path
	if q := query.Encode(); q != "" {
		fullPath += "?" + q
	}

	req, err := http.NewRequest(method, fullPath, b)
	if err != nil {
		return nil, requestID, err
	}

	req.Header.Set("Host", "localhost")
	req.Header.Set("X-Request-ID", requestID)
	req.Header.Set("Content-type", "application/json")

	return req, requestID, nil
}
// NewRequest constructs a new http.Request, with a body containing the json
// representation of body, if provided.
NewRequest constructs a new http.Request, with a body containing the json
representation of body, if provided.
// NewRequest constructs a new http . Request with a body containing the json // representation of body if provided .
func (c *Client) NewRequest(method, path string, query *url.Values, body interface{}, proxied bool) (*http.Request, string, error) {
	requestID := uuid.NewV4().String()
	b := &bytes.Buffer{}
	if body != nil {
		enc := json.NewEncoder(b)
		err := enc.Encode(body)
		if err != nil {
			return nil, requestID, err
		}
	}
	if query == nil {
		query = &url.Values{}
	}
	version := "v1"
	if proxied {
		version = "proxy"
	}
	fullPath := "http://localhost/" + version + path
	if q := query.Encode(); q != "" {
		fullPath += "?" + q
	}
	req, err := http.NewRequest(method, fullPath, b)
	if err != nil {
		return nil, requestID, err
	}
	req.Header.Set("Host", "localhost")
	req.Header.Set("X-Request-ID", requestID)
	req.Header.Set("Content-type", "application/json")
	return req, requestID, nil
}
func ( c * Client ) NewRequest ( method , path string , query * url . Values , body interface { } , proxied bool ) ( * http . Request , string , error ) { requestID := uuid . NewV4 ( ) . String ( ) b := & bytes . Buffer { } if body != nil { enc := json . NewEncoder ( b ) err := enc . Encode ( body ) if err != nil { return nil , requestID , err } } if query == nil { query = & url . Values { } } version := " " if proxied { version = " " } fullPath := " " + version + path if q := query . Encode ( ) ; q != " " { fullPath += " " + q } req , err := http . NewRequest ( method , fullPath , b ) if err != nil { return nil , requestID , err } req . Header . Set ( " " , " " ) req . Header . Set ( " " , requestID ) req . Header . Set ( " " , " " ) return req , requestID , nil }
NewRequest constructs a new http.Request, with a body containing the json
representation of body, if provided.
NewRequest constructs a new http . Request with a body containing the json representation of body if provided .