Skip to content

Commit ad5cf9c

Browse files
authored
Merge pull request #15 from speakeasy-api/bflad/remove-get-head-method-req-body
fix: Remove GET/HEAD method request body handling
2 parents 84377b3 + 0f29124 commit ad5cf9c

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

internal/method/service.go

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,10 @@ func HandleDelete(w http.ResponseWriter, r *http.Request) {
4444
}
4545

4646
func HandleGet(w http.ResponseWriter, r *http.Request) {
47-
type RequestBody struct {
48-
ID string `json:"id"`
49-
}
5047
type ResponseBody struct {
5148
Status string `json:"status"`
5249
}
5350

54-
var requestBody RequestBody
55-
56-
body, err := io.ReadAll(r.Body)
57-
58-
if err != nil {
59-
utils.HandleError(w, err)
60-
return
61-
}
62-
63-
if err := json.Unmarshal(body, &requestBody); err != nil {
64-
utils.HandleError(w, err)
65-
return
66-
}
67-
6851
w.Header().Set("Content-Type", "application/json")
6952
w.WriteHeader(http.StatusOK)
7053

@@ -79,24 +62,6 @@ func HandleGet(w http.ResponseWriter, r *http.Request) {
7962
}
8063

8164
func HandleHead(w http.ResponseWriter, r *http.Request) {
82-
type RequestBody struct {
83-
ID string `json:"id"`
84-
}
85-
86-
var requestBody RequestBody
87-
88-
body, err := io.ReadAll(r.Body)
89-
90-
if err != nil {
91-
utils.HandleError(w, err)
92-
return
93-
}
94-
95-
if err := json.Unmarshal(body, &requestBody); err != nil {
96-
utils.HandleError(w, err)
97-
return
98-
}
99-
10065
w.Header().Set("Content-Type", "application/json")
10166
w.WriteHeader(http.StatusOK)
10267
}

0 commit comments

Comments
 (0)