Skip to content

Commit

Permalink
style: 规范化命名
Browse files Browse the repository at this point in the history
  • Loading branch information
OverNaive committed May 20, 2021
1 parent 922cd6a commit 36db85c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/html2x.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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() {
Expand Down

0 comments on commit 36db85c

Please sign in to comment.