Added missing attributes to api search calls:

- Added an argument to the call() method in order to control the auth sharing
- Enabled it only for search. Pulls and pushes were enabled already.
- Grouped a few variable declarations

Docker-DCO-1.1-Signed-off-by: Roberto Hashioka <roberto.hashioka@docker.com> (github: rogaha)
This commit is contained in:
Roberto G. Hashioka 2014-01-21 04:06:19 +00:00
parent 275109a6ad
commit 4fe7a141bf

View File

@ -617,6 +617,10 @@ func (r *Registry) SearchRepositories(term string) (*SearchResults, error) {
if err != nil {
return nil, err
}
if r.authConfig != nil && len(r.authConfig.Username) > 0 {
req.SetBasicAuth(r.authConfig.Username, r.authConfig.Password)
}
req.Header.Set("X-Docker-Token", "true")
res, err := r.client.Do(req)
if err != nil {
return nil, err