convert to go #3
1 changed files with 3 additions and 3 deletions
6
main.go
6
main.go
|
|
@ -140,7 +140,7 @@ func sendToDeepDanbooru(fileContents []byte, fileName, mimeType, threshold strin
|
||||||
return nil, fmt.Errorf("read response: %w", err)
|
return nil, fmt.Errorf("read response: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
slog.Info("dd body", "body", string(respBody))
|
slog.Debug("dd body", "body", string(respBody))
|
||||||
|
|
||||||
var result WrappedResponse
|
var result WrappedResponse
|
||||||
if err := json.Unmarshal(respBody, &result); err != nil {
|
if err := json.Unmarshal(respBody, &result); err != nil {
|
||||||
|
|
@ -182,7 +182,7 @@ func sendToSDWebUI(fileContents []byte, fileName, mimeType, threshold string) (*
|
||||||
return nil, fmt.Errorf("read response: %w", err)
|
return nil, fmt.Errorf("read response: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
slog.Info("wd14 body", "body", string(respBody))
|
slog.Debug("wd14 body", "body", string(respBody))
|
||||||
|
|
||||||
var wd14Resp WD14Response
|
var wd14Resp WD14Response
|
||||||
if err := json.Unmarshal(respBody, &wd14Resp); err != nil {
|
if err := json.Unmarshal(respBody, &wd14Resp); err != nil {
|
||||||
|
|
@ -227,7 +227,7 @@ func isVideo(contentType, fileName string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeJSON(w http.ResponseWriter, v interface{}) {
|
func writeJSON(w http.ResponseWriter, v any) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(v)
|
json.NewEncoder(w).Encode(v)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue