mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-27 12:05:26 +00:00
Check json encoder errors
This commit is contained in:
parent
eb8d8f142c
commit
20d2615081
34
noise_api.go
34
noise_api.go
@ -313,7 +313,15 @@ func (h *Headscale) handleNoiseAuthKey(
|
|||||||
|
|
||||||
writer.Header().Set("Content-Type", "application/json")
|
writer.Header().Set("Content-Type", "application/json")
|
||||||
writer.WriteHeader(http.StatusOK)
|
writer.WriteHeader(http.StatusOK)
|
||||||
json.NewEncoder(writer).Encode(resp)
|
err = json.NewEncoder(writer).Encode(resp)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Err(err).
|
||||||
|
Msg("Failed to encode response")
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
log.Info().
|
log.Info().
|
||||||
Caller().
|
Caller().
|
||||||
@ -343,7 +351,13 @@ func (h *Headscale) handleNoiseNodeValidRegistration(
|
|||||||
Inc()
|
Inc()
|
||||||
writer.Header().Set("Content-Type", "application/json")
|
writer.Header().Set("Content-Type", "application/json")
|
||||||
writer.WriteHeader(http.StatusOK)
|
writer.WriteHeader(http.StatusOK)
|
||||||
json.NewEncoder(writer).Encode(resp)
|
err := json.NewEncoder(writer).Encode(resp)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Err(err).
|
||||||
|
Msg("Failed to encode response")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Headscale) handleNoiseMachineRegistrationNew(
|
func (h *Headscale) handleNoiseMachineRegistrationNew(
|
||||||
@ -370,7 +384,13 @@ func (h *Headscale) handleNoiseMachineRegistrationNew(
|
|||||||
|
|
||||||
writer.Header().Set("Content-Type", "application/json")
|
writer.Header().Set("Content-Type", "application/json")
|
||||||
writer.WriteHeader(http.StatusOK)
|
writer.WriteHeader(http.StatusOK)
|
||||||
json.NewEncoder(writer).Encode(resp)
|
err := json.NewEncoder(writer).Encode(resp)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Err(err).
|
||||||
|
Msg("Failed to encode response")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Headscale) handleNoiseNodeLogOut(
|
func (h *Headscale) handleNoiseNodeLogOut(
|
||||||
@ -430,7 +450,13 @@ func (h *Headscale) handleNoiseNodeRefreshKey(
|
|||||||
|
|
||||||
writer.Header().Set("Content-Type", "application/json")
|
writer.Header().Set("Content-Type", "application/json")
|
||||||
writer.WriteHeader(http.StatusOK)
|
writer.WriteHeader(http.StatusOK)
|
||||||
json.NewEncoder(writer).Encode(resp)
|
err := json.NewEncoder(writer).Encode(resp)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Err(err).
|
||||||
|
Msg("Failed to encode response")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Headscale) handleNoiseNodeExpired(
|
func (h *Headscale) handleNoiseNodeExpired(
|
||||||
|
Loading…
Reference in New Issue
Block a user