@@ -22,21 +22,20 @@ type DigestTransport struct {
22
22
Username string
23
23
}
24
24
25
- func NewRequest (username string , password string , method string , uri string , body string ) DigestRequest {
25
+ func NewRequest (username , password , method , uri , body string ) DigestRequest {
26
26
dr := DigestRequest {}
27
27
dr .UpdateRequest (username , password , method , uri , body )
28
28
return dr
29
29
}
30
30
31
- func NewTransport (username string , password string ) DigestTransport {
31
+ func NewTransport (username , password string ) DigestTransport {
32
32
dt := DigestTransport {}
33
33
dt .Password = password
34
34
dt .Username = username
35
35
return dt
36
36
}
37
37
38
- func (dr * DigestRequest ) UpdateRequest (username string ,
39
- password string , method string , uri string , body string ) * DigestRequest {
38
+ func (dr * DigestRequest ) UpdateRequest (username , password , method , uri , body string ) * DigestRequest {
40
39
41
40
dr .Body = body
42
41
dr .Method = method
@@ -98,7 +97,7 @@ func (dr *DigestRequest) executeNewDigest(resp *http.Response) (*http.Response,
98
97
99
98
waString := resp .Header .Get ("WWW-Authenticate" )
100
99
if waString == "" {
101
- return nil , fmt .Errorf ("Failed to get WWW-Authenticate header, please check your server configuration. " )
100
+ return nil , fmt .Errorf ("failed to get WWW-Authenticate header, please check your server configuration" )
102
101
}
103
102
wa = newWwwAuthenticate (waString )
104
103
dr .Wa = wa
@@ -108,12 +107,12 @@ func (dr *DigestRequest) executeNewDigest(resp *http.Response) (*http.Response,
108
107
}
109
108
authString := auth .toString ()
110
109
111
- if resp , err := dr .executeRequest (authString ); err != nil {
110
+ if _ , err := dr .executeRequest (authString ); err != nil {
112
111
return nil , err
113
- } else {
114
- dr .Auth = auth
115
- return resp , nil
116
112
}
113
+
114
+ dr .Auth = auth
115
+ return resp , nil
117
116
}
118
117
119
118
func (dr * DigestRequest ) executeExistingDigest () (* http.Response , error ) {
@@ -141,7 +140,6 @@ func (dr *DigestRequest) executeRequest(authString string) (*http.Response, erro
141
140
return nil , err
142
141
}
143
142
144
- // fmt.Printf("AUTHSTRING: %s\n\n", authString)
145
143
req .Header .Add ("Authorization" , authString )
146
144
147
145
client := & http.Client {
0 commit comments