Skip to content

Commit

Permalink
fix(stein): fix response & slash
Browse files Browse the repository at this point in the history
  • Loading branch information
nasrul21 committed Apr 22, 2021
1 parent e599efb commit 667631d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion response.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type InsertReponse struct {
}

type UpdateReponse struct {
UpdatedRange string `json:"updatedRange"`
TotalUpdatedRows int `json:"totalUpdatedRows"`
}

type DeleteResponse struct {
Expand Down
11 changes: 4 additions & 7 deletions stein.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ func (s *Stein) Insert(sheetName string, body interface{}) (status int, res Inse

reqBody := bytes.NewReader(reqByte)

response := new(InsertReponse)
status, err = s.Call(http.MethodPost, sheetName, reqBody, &response)
status, err = s.Call(http.MethodPost, sheetName, reqBody, &res)
if err != nil {
return
}
Expand All @@ -85,8 +84,7 @@ func (s *Stein) Update(sheetName string, set interface{}, condition map[string]i

reqBody := bytes.NewReader(reqByte)

response := new(UpdateReponse)
status, err = s.Call(http.MethodPut, sheetName, reqBody, &response)
status, err = s.Call(http.MethodPut, sheetName, reqBody, &res)
if err != nil {
return
}
Expand All @@ -107,8 +105,7 @@ func (s *Stein) Delete(sheetName string, condition map[string]interface{}) (stat

reqBody := bytes.NewReader(reqByte)

response := new(DeleteResponse)
status, err = s.Call(http.MethodDelete, sheetName, reqBody, &response)
status, err = s.Call(http.MethodDelete, sheetName, reqBody, &res)
if err != nil {
return
}
Expand Down Expand Up @@ -156,7 +153,7 @@ func (s *Stein) executeRequest(req *http.Request, v interface{}) (status int, er
// given to `v` if there is no error. If any error occurred, the return of this function is the error
// itself, otherwise nil.
func (s *Stein) Call(method, path string, body io.Reader, v interface{}) (status int, err error) {
req, err := s.newRequest(method, s.BaseURL+path, body)
req, err := s.newRequest(method, s.BaseURL+"/"+path, body)
if err != nil {
return http.StatusInternalServerError, err
}
Expand Down

0 comments on commit 667631d

Please sign in to comment.