23 lines
539 B
Go
23 lines
539 B
Go
package handlers
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
func (d *Deps) AdminResetData(w http.ResponseWriter, r *http.Request) {
|
|
client := &http.Client{Timeout: 10 * time.Second}
|
|
resp, err := client.Post(d.TushareURL+"/api/v1/admin/reset-data", "application/json", nil)
|
|
if err != nil {
|
|
writeErr(w, http.StatusBadGateway, fmt.Sprintf("tushare service unavailable: %v", err))
|
|
return
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(resp.StatusCode)
|
|
_, _ = io.Copy(w, resp.Body)
|
|
}
|