func (c *Client) post(config *config.ApiConfig, apiReq interface{}, resp interface{}, reqBody []byte, header map[string]string) error {
	host := config.Host
	//Only for testing purposes
	if c.testUrl != "" {
		host = c.testUrl
	}

	req, err := http.NewRequest(http.MethodPost, host+config.Path, bytes.NewBuffer(reqBody))
	if err != nil {
		return errors.New("failed to make a request to" + host + config.Path)
	}

	//Set Headers
	for i, v := range header {
		req.Header.Set(i, v)
	}

	if err := c.do(req, resp); err != nil {
		return err
	}

	return nil
}
// Make a http POST Request to the Server
Make a http POST Request to the Server
// Make a http POST Request to the Server
func (c *Client) post(config *config.ApiConfig, apiReq interface{}, resp interface{}, reqBody []byte, header map[string]string) error {
	host := config.Host
	if c.testUrl != "" {
		host = c.testUrl
	}
	req, err := http.NewRequest(http.MethodPost, host+config.Path, bytes.NewBuffer(reqBody))
	if err != nil {
		return errors.New("failed to make a request to" + host + config.Path)
	}
	for i, v := range header {
		req.Header.Set(i, v)
	}
	if err := c.do(req, resp); err != nil {
		return err
	}
	return nil
}
func ( c * Client ) post ( config * config . ApiConfig , apiReq interface { } , resp interface { } , reqBody [ ] byte , header map [ string ] string ) error { host := config . Host if c . testUrl != " " { host = c . testUrl } req , err := http . NewRequest ( http . MethodPost , host + config . Path , bytes . NewBuffer ( reqBody ) ) if err != nil { return errors . New ( " " + host + config . Path ) } for i , v := range header { req . Header . Set ( i , v ) } if err := c . do ( req , resp ) ; err != nil { return err } return nil }
Make a http POST Request to the Server
Make a http POST Request to the Server
//Only for testing purposes //Set Headers