Skip to content

Commit 4554f9f

Browse files
committed
style: 规范化命名
1 parent 027517b commit 4554f9f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: src/html2x.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ type requestBody struct {
1616
Args []string `json:"args"`
1717
}
1818

19-
func htmlToPdf(w http.ResponseWriter, r *http.Request) {
20-
if r.Method != "POST" {
19+
func htmlToPdf(w http.ResponseWriter, req *http.Request) {
20+
if req.Method != "POST" {
2121
http.Error(w, "Invalid request method", http.StatusMethodNotAllowed)
2222
return
2323
}
2424

25-
if ! strings.HasPrefix(r.Header.Get("Content-Type"), "application/json") {
25+
if ! strings.HasPrefix(req.Header.Get("Content-Type"), "application/json") {
2626
http.Error(w, "Invalid content type", http.StatusUnsupportedMediaType)
2727
return
2828
}
2929

3030
var b requestBody
3131

32-
err := json.NewDecoder(r.Body).Decode(&b)
32+
err := json.NewDecoder(req.Body).Decode(&b)
3333
if err != nil {
3434
http.Error(w, err.Error(), http.StatusBadRequest)
3535
return
@@ -58,7 +58,7 @@ func htmlToPdf(w http.ResponseWriter, r *http.Request) {
5858
return
5959
}
6060

61-
http.ServeFile(w, r, pdfPath)
61+
http.ServeFile(w, req, pdfPath)
6262
}
6363

6464
func main() {

0 commit comments

Comments
 (0)