forked from TrueCloudLab/certificates
ca: refactored to support api/render.Error
This commit is contained in:
parent
098c2e1134
commit
d49c00b0d7
2 changed files with 3 additions and 3 deletions
|
@ -96,7 +96,7 @@ func mTLSMiddleware(next http.Handler, nonAuthenticatedPaths ...string) http.Han
|
||||||
}
|
}
|
||||||
isMTLS := r.TLS != nil && len(r.TLS.PeerCertificates) > 0
|
isMTLS := r.TLS != nil && len(r.TLS.PeerCertificates) > 0
|
||||||
if !isMTLS {
|
if !isMTLS {
|
||||||
api.WriteError(w, errs.Unauthorized("missing peer certificate"))
|
render.Error(w, errs.Unauthorized("missing peer certificate"))
|
||||||
} else {
|
} else {
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ func TestClient_Sign(t *testing.T) {
|
||||||
if err := read.JSON(req.Body, body); err != nil {
|
if err := read.JSON(req.Body, body); err != nil {
|
||||||
e, ok := tt.response.(error)
|
e, ok := tt.response.(error)
|
||||||
assert.Fatal(t, ok, "response expected to be error type")
|
assert.Fatal(t, ok, "response expected to be error type")
|
||||||
api.WriteError(w, e)
|
render.Error(w, e)
|
||||||
return
|
return
|
||||||
} else if !equalJSON(t, body, tt.request) {
|
} else if !equalJSON(t, body, tt.request) {
|
||||||
if tt.request == nil {
|
if tt.request == nil {
|
||||||
|
@ -433,7 +433,7 @@ func TestClient_Revoke(t *testing.T) {
|
||||||
if err := read.JSON(req.Body, body); err != nil {
|
if err := read.JSON(req.Body, body); err != nil {
|
||||||
e, ok := tt.response.(error)
|
e, ok := tt.response.(error)
|
||||||
assert.Fatal(t, ok, "response expected to be error type")
|
assert.Fatal(t, ok, "response expected to be error type")
|
||||||
api.WriteError(w, e)
|
render.Error(w, e)
|
||||||
return
|
return
|
||||||
} else if !equalJSON(t, body, tt.request) {
|
} else if !equalJSON(t, body, tt.request) {
|
||||||
if tt.request == nil {
|
if tt.request == nil {
|
||||||
|
|
Loading…
Reference in a new issue