Handle encoding error for generating url api
This commit is contained in:
parent
4858c7493b
commit
05728d1209
1 changed files with 5 additions and 1 deletions
|
@ -38,6 +38,10 @@ func HandleGenerateUrl(s3 S3) http.HandlerFunc {
|
|||
|
||||
encoder := json.NewEncoder(w)
|
||||
encoder.SetEscapeHTML(false)
|
||||
encoder.Encode(map[string]string{"url": url.String()})
|
||||
err = encoder.Encode(map[string]string{"url": url.String()})
|
||||
if err != nil {
|
||||
handleHTTPError(w, fmt.Errorf("error encoding JSON: %w", err))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue