func (c *Client) login(username string, password string) (*ex.User, error) {
	loginRequest := fmt.Sprintf(`
    {
      "username":"%s",
      "password": "%s"
    }`, username, password)

	res, err := http.Post(fmt.Sprintf("%s/login/10?foo=anything", c.Host), "application/json; charset=utf-8", bytes.NewReader([]byte(loginRequest)))
	if res.StatusCode != 200 || err != nil {
		return nil, fmt.Errorf("login failed")
	}

	data, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return nil, err
	}

	var response loginResponse
	err = json.Unmarshal(data, &response)
	if err != nil {
		return nil, err
	}

	return &response.User, err
}
func (c *Client) login(username string, password string) (*ex.User, error) {
	loginRequest := fmt.Sprintf(`
    {
      "username":"%s",
      "password": "%s"
    }`, username, password)

	res, err := http.Post(fmt.Sprintf("%s/login/10?foo=anything", c.Host), "application/json; charset=utf-8", bytes.NewReader([]byte(loginRequest)))
	if res.StatusCode != 200 || err != nil {
		return nil, fmt.Errorf("login failed")
	}

	data, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return nil, err
	}

	var response loginResponse
	err = json.Unmarshal(data, &response)
	if err != nil {
		return nil, err
	}

	return &response.User, err
}
func ( c * Client ) login ( username string , password string ) ( * ex . User , error ) { loginRequest := fmt . Sprintf ( `
    {
      "username":"%s",
      "password": "%s"
    }` , username , password ) res , err := http . Post ( fmt . Sprintf ( " " , c . Host ) , " " , bytes . NewReader ( [ ] byte ( loginRequest ) ) ) if res . StatusCode != 200 || err != nil { return nil , fmt . Errorf ( " " ) } data , err := ioutil . ReadAll ( res . Body ) if err != nil { return nil , err } var response loginResponse err = json . Unmarshal ( data , & response ) if err != nil { return nil , err } return & response . User , err }
// Login handles the login API call to the User Service.
Login handles the login API call to the User Service .