Skip to content
Myr

minor tweaks,optimize code (#2788)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Lanco · committed by GitHub · parent dfc25f9 · Browse files · 1 file+8 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−10 removed

  • other:+8 added−10 removed

1 file+8 added−10 removed

modified:render/json.go+8 added-10 removed
100 unmodified lines
101 }102 // if the jsonBytes is array values103 if bytes.HasPrefix(jsonBytes, bytesconv.StringToBytes("[")) && bytes.HasSuffix(jsonBytes,104 bytesconv.StringToBytes("]")) {105 _, err = w.Write(bytesconv.StringToBytes(r.Prefix))106 if err != nil {105 if _, err = w.Write(bytesconv.StringToBytes(r.Prefix)); err != nil {106 return err107 }108 }109 _, err = w.Write(jsonBytes)
18 unmodified lines
128 return err129 }130131 callback := template.JSEscapeString(r.Callback)133 _, err = w.Write(bytesconv.StringToBytes(callback))134 if err != nil {132 if _, err = w.Write(bytesconv.StringToBytes(callback)); err != nil {133 return err134 }137 _, err = w.Write(bytesconv.StringToBytes("("))138 if err != nil {135136 if _, err = w.Write(bytesconv.StringToBytes("(")); err != nil {137 return err138 }141 _, err = w.Write(ret)142 if err != nil {139140 if _, err = w.Write(ret); err != nil {141 return err142 }145 _, err = w.Write(bytesconv.StringToBytes(");"))146 if err != nil {143144 if _, err = w.Write(bytesconv.StringToBytes(");")); err != nil {145 return err146 }147148 return nil
45 unmodified lines