@@ -108,7 +108,7 @@ func TestHandler_baseURLFromRequest(t *testing.T) {
108
108
}
109
109
110
110
func TestHandler_addNonce (t * testing.T ) {
111
- url := "https://ca.smallstep.com/acme/new-nonce"
111
+ u := "https://ca.smallstep.com/acme/new-nonce"
112
112
type test struct {
113
113
db acme.DB
114
114
err * acme.Error
@@ -141,7 +141,7 @@ func TestHandler_addNonce(t *testing.T) {
141
141
tc := run (t )
142
142
t .Run (name , func (t * testing.T ) {
143
143
h := & Handler {db : tc .db }
144
- req := httptest .NewRequest ("GET" , url , nil )
144
+ req := httptest .NewRequest ("GET" , u , nil )
145
145
w := httptest .NewRecorder ()
146
146
h .addNonce (testNext )(w , req )
147
147
res := w .Result ()
@@ -230,7 +230,7 @@ func TestHandler_verifyContentType(t *testing.T) {
230
230
prov := newProv ()
231
231
escProvName := url .PathEscape (prov .GetName ())
232
232
baseURL := & url.URL {Scheme : "https" , Host : "test.ca.smallstep.com" }
233
- url := fmt .Sprintf ("%s/acme/%s/certificate/abc123" , baseURL .String (), escProvName )
233
+ u := fmt .Sprintf ("%s/acme/%s/certificate/abc123" , baseURL .String (), escProvName )
234
234
type test struct {
235
235
h Handler
236
236
ctx context.Context
@@ -245,7 +245,7 @@ func TestHandler_verifyContentType(t *testing.T) {
245
245
h : Handler {
246
246
linker : NewLinker ("dns" , "acme" ),
247
247
},
248
- url : url ,
248
+ url : u ,
249
249
ctx : context .Background (),
250
250
contentType : "foo" ,
251
251
statusCode : 500 ,
@@ -257,7 +257,7 @@ func TestHandler_verifyContentType(t *testing.T) {
257
257
h : Handler {
258
258
linker : NewLinker ("dns" , "acme" ),
259
259
},
260
- url : url ,
260
+ url : u ,
261
261
ctx : context .WithValue (context .Background (), provisionerContextKey , prov ),
262
262
contentType : "foo" ,
263
263
statusCode : 400 ,
@@ -319,11 +319,11 @@ func TestHandler_verifyContentType(t *testing.T) {
319
319
for name , run := range tests {
320
320
tc := run (t )
321
321
t .Run (name , func (t * testing.T ) {
322
- _url := url
322
+ _u := u
323
323
if tc .url != "" {
324
- _url = tc .url
324
+ _u = tc .url
325
325
}
326
- req := httptest .NewRequest ("GET" , _url , nil )
326
+ req := httptest .NewRequest ("GET" , _u , nil )
327
327
req = req .WithContext (tc .ctx )
328
328
req .Header .Add ("Content-Type" , tc .contentType )
329
329
w := httptest .NewRecorder ()
@@ -353,7 +353,7 @@ func TestHandler_verifyContentType(t *testing.T) {
353
353
}
354
354
355
355
func TestHandler_isPostAsGet (t * testing.T ) {
356
- url := "https://ca.smallstep.com/acme/new-account"
356
+ u := "https://ca.smallstep.com/acme/new-account"
357
357
type test struct {
358
358
ctx context.Context
359
359
err * acme.Error
@@ -392,7 +392,7 @@ func TestHandler_isPostAsGet(t *testing.T) {
392
392
tc := run (t )
393
393
t .Run (name , func (t * testing.T ) {
394
394
h := & Handler {}
395
- req := httptest .NewRequest ("GET" , url , nil )
395
+ req := httptest .NewRequest ("GET" , u , nil )
396
396
req = req .WithContext (tc .ctx )
397
397
w := httptest .NewRecorder ()
398
398
h .isPostAsGet (testNext )(w , req )
@@ -430,7 +430,7 @@ func (errReader) Close() error {
430
430
}
431
431
432
432
func TestHandler_parseJWS (t * testing.T ) {
433
- url := "https://ca.smallstep.com/acme/new-account"
433
+ u := "https://ca.smallstep.com/acme/new-account"
434
434
type test struct {
435
435
next nextHTTP
436
436
body io.Reader
@@ -483,7 +483,7 @@ func TestHandler_parseJWS(t *testing.T) {
483
483
tc := run (t )
484
484
t .Run (name , func (t * testing.T ) {
485
485
h := & Handler {}
486
- req := httptest .NewRequest ("GET" , url , tc .body )
486
+ req := httptest .NewRequest ("GET" , u , tc .body )
487
487
w := httptest .NewRecorder ()
488
488
h .parseJWS (tc .next )(w , req )
489
489
res := w .Result ()
@@ -528,7 +528,7 @@ func TestHandler_verifyAndExtractJWSPayload(t *testing.T) {
528
528
assert .FatalError (t , err )
529
529
parsedJWS , err := jose .ParseJWS (raw )
530
530
assert .FatalError (t , err )
531
- url := "https://ca.smallstep.com/acme/account/1234"
531
+ u := "https://ca.smallstep.com/acme/account/1234"
532
532
type test struct {
533
533
ctx context.Context
534
534
next func (http.ResponseWriter , * http.Request )
@@ -681,7 +681,7 @@ func TestHandler_verifyAndExtractJWSPayload(t *testing.T) {
681
681
tc := run (t )
682
682
t .Run (name , func (t * testing.T ) {
683
683
h := & Handler {}
684
- req := httptest .NewRequest ("GET" , url , nil )
684
+ req := httptest .NewRequest ("GET" , u , nil )
685
685
req = req .WithContext (tc .ctx )
686
686
w := httptest .NewRecorder ()
687
687
h .verifyAndExtractJWSPayload (tc .next )(w , req )
@@ -713,7 +713,7 @@ func TestHandler_lookupJWK(t *testing.T) {
713
713
prov := newProv ()
714
714
provName := url .PathEscape (prov .GetName ())
715
715
baseURL := & url.URL {Scheme : "https" , Host : "test.ca.smallstep.com" }
716
- url := fmt .Sprintf ("%s/acme/%s/account/1234" ,
716
+ u := fmt .Sprintf ("%s/acme/%s/account/1234" ,
717
717
baseURL , provName )
718
718
jwk , err := jose .GenerateJWK ("EC" , "P-256" , "ES256" , "sig" , "" , 0 )
719
719
assert .FatalError (t , err )
@@ -883,7 +883,7 @@ func TestHandler_lookupJWK(t *testing.T) {
883
883
tc := run (t )
884
884
t .Run (name , func (t * testing.T ) {
885
885
h := & Handler {db : tc .db , linker : tc .linker }
886
- req := httptest .NewRequest ("GET" , url , nil )
886
+ req := httptest .NewRequest ("GET" , u , nil )
887
887
req = req .WithContext (tc .ctx )
888
888
w := httptest .NewRecorder ()
889
889
h .lookupJWK (tc .next )(w , req )
@@ -934,7 +934,7 @@ func TestHandler_extractJWK(t *testing.T) {
934
934
assert .FatalError (t , err )
935
935
parsedJWS , err := jose .ParseJWS (raw )
936
936
assert .FatalError (t , err )
937
- url := fmt .Sprintf ("https://ca.smallstep.com/acme/%s/account/1234" ,
937
+ u := fmt .Sprintf ("https://ca.smallstep.com/acme/%s/account/1234" ,
938
938
provName )
939
939
type test struct {
940
940
db acme.DB
@@ -1079,7 +1079,7 @@ func TestHandler_extractJWK(t *testing.T) {
1079
1079
tc := run (t )
1080
1080
t .Run (name , func (t * testing.T ) {
1081
1081
h := & Handler {db : tc .db }
1082
- req := httptest .NewRequest ("GET" , url , nil )
1082
+ req := httptest .NewRequest ("GET" , u , nil )
1083
1083
req = req .WithContext (tc .ctx )
1084
1084
w := httptest .NewRecorder ()
1085
1085
h .extractJWK (tc .next )(w , req )
@@ -1108,7 +1108,7 @@ func TestHandler_extractJWK(t *testing.T) {
1108
1108
}
1109
1109
1110
1110
func TestHandler_validateJWS (t * testing.T ) {
1111
- url := "https://ca.smallstep.com/acme/account/1234"
1111
+ u := "https://ca.smallstep.com/acme/account/1234"
1112
1112
type test struct {
1113
1113
db acme.DB
1114
1114
ctx context.Context
@@ -1198,7 +1198,7 @@ func TestHandler_validateJWS(t *testing.T) {
1198
1198
Algorithm : jose .RS256 ,
1199
1199
JSONWebKey : & pub ,
1200
1200
ExtraHeaders : map [jose.HeaderKey ]interface {}{
1201
- "url" : url ,
1201
+ "url" : u ,
1202
1202
},
1203
1203
},
1204
1204
},
@@ -1226,7 +1226,7 @@ func TestHandler_validateJWS(t *testing.T) {
1226
1226
Algorithm : jose .RS256 ,
1227
1227
JSONWebKey : & pub ,
1228
1228
ExtraHeaders : map [jose.HeaderKey ]interface {}{
1229
- "url" : url ,
1229
+ "url" : u ,
1230
1230
},
1231
1231
},
1232
1232
},
@@ -1298,7 +1298,7 @@ func TestHandler_validateJWS(t *testing.T) {
1298
1298
},
1299
1299
ctx : context .WithValue (context .Background (), jwsContextKey , jws ),
1300
1300
statusCode : 400 ,
1301
- err : acme .NewError (acme .ErrorMalformedType , "url header in JWS (foo) does not match request url (%s)" , url ),
1301
+ err : acme .NewError (acme .ErrorMalformedType , "url header in JWS (foo) does not match request url (%s)" , u ),
1302
1302
}
1303
1303
},
1304
1304
"fail/both-jwk-kid" : func (t * testing.T ) test {
@@ -1313,7 +1313,7 @@ func TestHandler_validateJWS(t *testing.T) {
1313
1313
KeyID : "bar" ,
1314
1314
JSONWebKey : & pub ,
1315
1315
ExtraHeaders : map [jose.HeaderKey ]interface {}{
1316
- "url" : url ,
1316
+ "url" : u ,
1317
1317
},
1318
1318
},
1319
1319
},
@@ -1337,7 +1337,7 @@ func TestHandler_validateJWS(t *testing.T) {
1337
1337
Protected : jose.Header {
1338
1338
Algorithm : jose .ES256 ,
1339
1339
ExtraHeaders : map [jose.HeaderKey ]interface {}{
1340
- "url" : url ,
1340
+ "url" : u ,
1341
1341
},
1342
1342
},
1343
1343
},
@@ -1362,7 +1362,7 @@ func TestHandler_validateJWS(t *testing.T) {
1362
1362
Algorithm : jose .ES256 ,
1363
1363
KeyID : "bar" ,
1364
1364
ExtraHeaders : map [jose.HeaderKey ]interface {}{
1365
- "url" : url ,
1365
+ "url" : u ,
1366
1366
},
1367
1367
},
1368
1368
},
@@ -1392,7 +1392,7 @@ func TestHandler_validateJWS(t *testing.T) {
1392
1392
Algorithm : jose .ES256 ,
1393
1393
JSONWebKey : & pub ,
1394
1394
ExtraHeaders : map [jose.HeaderKey ]interface {}{
1395
- "url" : url ,
1395
+ "url" : u ,
1396
1396
},
1397
1397
},
1398
1398
},
@@ -1422,7 +1422,7 @@ func TestHandler_validateJWS(t *testing.T) {
1422
1422
Algorithm : jose .RS256 ,
1423
1423
JSONWebKey : & pub ,
1424
1424
ExtraHeaders : map [jose.HeaderKey ]interface {}{
1425
- "url" : url ,
1425
+ "url" : u ,
1426
1426
},
1427
1427
},
1428
1428
},
@@ -1446,7 +1446,7 @@ func TestHandler_validateJWS(t *testing.T) {
1446
1446
tc := run (t )
1447
1447
t .Run (name , func (t * testing.T ) {
1448
1448
h := & Handler {db : tc .db }
1449
- req := httptest .NewRequest ("GET" , url , nil )
1449
+ req := httptest .NewRequest ("GET" , u , nil )
1450
1450
req = req .WithContext (tc .ctx )
1451
1451
w := httptest .NewRecorder ()
1452
1452
h .validateJWS (tc .next )(w , req )
0 commit comments