From 36db85cd8ff0e974a3497c16b2ab393da3df33f8 Mon Sep 17 00:00:00 2001 From: OverNaive Date: Thu, 20 May 2021 21:23:47 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E8=A7=84=E8=8C=83=E5=8C=96=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/html2x.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/html2x.go b/src/html2x.go index 45e79ce..7b8a5a7 100644 --- a/src/html2x.go +++ b/src/html2x.go @@ -7,10 +7,10 @@ import ( "time" ) -func htmlToPdf(w http.ResponseWriter, req *http.Request) { - var b requestBody +func htmlToPdf(w http.ResponseWriter, r *http.Request) { + var rb requestBody - err := parseRequest(req, &b) + err := parseRequest(r, &rb) if err != nil { var mr *malformedRequest @@ -24,21 +24,21 @@ func htmlToPdf(w http.ResponseWriter, req *http.Request) { } var pdfPath string - pdfPath, err = b.ToPdf() - defer b.Remove() + pdfPath, err = rb.ToPdf() + defer rb.Remove() if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - http.ServeFile(w, req, pdfPath) + http.ServeFile(w, r, pdfPath) } -func htmlToImg(w http.ResponseWriter, req *http.Request) { - var b requestBody +func htmlToImg(w http.ResponseWriter, r *http.Request) { + var rb requestBody - err := parseRequest(req, &b) + err := parseRequest(r, &rb) if err != nil { var mr *malformedRequest @@ -52,15 +52,15 @@ func htmlToImg(w http.ResponseWriter, req *http.Request) { } var imgPath string - imgPath, err = b.ToImg() - defer b.Remove() + imgPath, err = rb.ToImg() + defer rb.Remove() if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - http.ServeFile(w, req, imgPath) + http.ServeFile(w, r, imgPath) } func main() {