1
0

feat: 改为Post取参数

This commit is contained in:
502647092 2018-09-11 21:04:05 +08:00
parent f57ac365b4
commit c9c7834291
2 changed files with 1 additions and 1 deletions

BIN
main

Binary file not shown.

View File

@ -18,7 +18,7 @@ func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
uid, _ := uuid.NewV4() uid, _ := uuid.NewV4()
uuid := "html2pic-" + uid.String() uuid := "html2pic-" + uid.String()
url, html := r.FormValue("url"), r.FormValue("html") url, html := r.PostFormValue("url"), r.PostFormValue("html")
tempFile := *tempDir + "/" + uuid + ".html" tempFile := *tempDir + "/" + uuid + ".html"
if html != "" { if html != "" {
ioutil.WriteFile(tempFile, []byte("<!DOCTYPE html><html lang=\"zh\"><head><meta charset=\"UTF-8\"></head><body style=\"margin: 0;padding: 0;\">"+html+"</body></html>"), os.ModeAppend) ioutil.WriteFile(tempFile, []byte("<!DOCTYPE html><html lang=\"zh\"><head><meta charset=\"UTF-8\"></head><body style=\"margin: 0;padding: 0;\">"+html+"</body></html>"), os.ModeAppend)