Merge pull request #317 from dotcloud/307-loginfix

Fix for #307
This commit is contained in:
Joffrey F 2013-04-02 03:01:23 -07:00
Родитель 3478d6f706 8fed600077
Коммит 927308cfd9
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -1,7 +1,6 @@
package auth package auth
import ( import (
"bytes"
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"errors" "errors"
@ -112,7 +111,8 @@ func Login(authConfig *AuthConfig) (string, error) {
return "", errors.New(errMsg) return "", errors.New(errMsg)
} }
b := bytes.NewReader(jsonBody) // using `bytes.NewReader(jsonBody)` here causes the server to respond with a 411 status.
b := strings.NewReader(string(jsonBody))
req1, err := http.Post(REGISTRY_SERVER+"/v1/users", "application/json; charset=utf-8", b) req1, err := http.Post(REGISTRY_SERVER+"/v1/users", "application/json; charset=utf-8", b)
if err != nil { if err != nil {
errMsg = fmt.Sprintf("Server Error: %s", err) errMsg = fmt.Sprintf("Server Error: %s", err)