build: modernize with "go fix -errorsastype": use errors.AsType

This commit is contained in:
Nick Craig-Wood
2026-08-21 12:23:31 +01:00
parent 77f9c70cf6
commit 33e9251b52
9 changed files with 15 additions and 30 deletions
+1 -2
View File
@@ -307,8 +307,7 @@ func (s *server) serviceControlHandler(w http.ResponseWriter, r *http.Request) {
var env soap.Envelope
r.Body = http.MaxBytesReader(w, r.Body, maxSOAPBodySize)
if err := xml.NewDecoder(r.Body).Decode(&env); err != nil {
var maxBytesErr *http.MaxBytesError
if errors.As(err, &maxBytesErr) {
if _, ok := errors.AsType[*http.MaxBytesError](err); ok {
http.Error(w, "SOAP request body too large", http.StatusRequestEntityTooLarge)
return
}