Forráskód Böngészése

Change CRL unavailable case to HTTP 404

Herman Slatman 2 éve
szülő
commit
3dbb4aad3d
2 módosított fájl, 2 hozzáadás és 2 törlés
  1. 1 1
      api/crl.go
  2. 1 1
      api/crl_test.go

+ 1 - 1
api/crl.go

@@ -18,7 +18,7 @@ func CRL(w http.ResponseWriter, r *http.Request) {
 	}
 
 	if crlInfo == nil {
-		render.Error(w, errs.New(http.StatusInternalServerError, "no CRL available"))
+		render.Error(w, errs.New(http.StatusNotFound, "no CRL available"))
 		return
 	}
 

+ 1 - 1
api/crl_test.go

@@ -45,7 +45,7 @@ func Test_CRL(t *testing.T) {
 		{"ok/empty", "http://example.com/crl", nil, http.StatusOK, &authority.CertificateRevocationListInfo{Data: nil}, nil, http.Header{"Content-Type": []string{"application/pkix-crl"}, "Content-Disposition": []string{`attachment; filename="crl.der"`}}, ""},
 		{"ok/empty-pem", "http://example.com/crl?pem=true", nil, http.StatusOK, &authority.CertificateRevocationListInfo{Data: nil}, emptyPEMData, http.Header{"Content-Type": []string{"application/x-pem-file"}, "Content-Disposition": []string{`attachment; filename="crl.pem"`}}, ""},
 		{"fail/internal", "http://example.com/crl", errs.Wrap(http.StatusInternalServerError, errors.New("failure"), "authority.GetCertificateRevocationList"), http.StatusInternalServerError, nil, nil, http.Header{}, `{"status":500,"message":"The certificate authority encountered an Internal Server Error. Please see the certificate authority logs for more info."}`},
-		{"fail/nil", "http://example.com/crl", nil, http.StatusInternalServerError, nil, nil, http.Header{}, `{"status":500,"message":"no CRL available"}`},
+		{"fail/nil", "http://example.com/crl", nil, http.StatusNotFound, nil, nil, http.Header{}, `{"status":404,"message":"no CRL available"}`},
 	}
 
 	for _, tt := range tests {