Skip to content

Commit 09ca584

Browse files
committed
refactor: use http method constant
1 parent 96bb03a commit 09ca584

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

collection.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ package polybase
1010
import (
1111
"context"
1212
"fmt"
13+
"net/http"
1314
"net/url"
1415
)
1516

@@ -38,7 +39,7 @@ func (c *collection[T]) Get(ctx context.Context) *Response[T] {
3839

3940
req := &Request{
4041
Endpoint: fmt.Sprintf("/collections/%s/records", c.name),
41-
Method: "GET",
42+
Method: http.MethodGet,
4243
}
4344

4445
var resp Response[T]
@@ -85,7 +86,7 @@ func (c *collection[T]) Create(ctx context.Context, args []any) *SingleResponse[
8586

8687
req := &Request{
8788
Endpoint: fmt.Sprintf("/collections/%s/records", c.name),
88-
Method: "POST",
89+
Method: http.MethodPost,
8990
Body: Body{Args: args},
9091
}
9192

query.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"context"
1212
"encoding/json"
1313
"fmt"
14+
"net/http"
1415
)
1516

1617
type WhereOperator string
@@ -49,7 +50,7 @@ func (q *query[T]) Get(ctx context.Context) *Response[T] {
4950

5051
req := &Request{
5152
Endpoint: q.endpoint + q.build(),
52-
Method: "GET",
53+
Method: http.MethodGet,
5354
}
5455

5556
var resp Response[T]

record.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ package polybase
1010
import (
1111
"context"
1212
"fmt"
13+
"net/http"
1314
"net/url"
1415
)
1516

@@ -52,7 +53,7 @@ func (r recordDoer[T]) Get(ctx context.Context) *SingleResponse[T] {
5253

5354
req := &Request{
5455
Endpoint: r.endpoint,
55-
Method: "GET",
56+
Method: http.MethodGet,
5657
}
5758

5859
var resp SingleResponse[T]
@@ -71,7 +72,7 @@ func (r recordDoer[T]) Call(ctx context.Context, fc string, args []any) *SingleR
7172

7273
req := &Request{
7374
Endpoint: r.endpoint + fmt.Sprintf("/call/%s", url.QueryEscape(fc)),
74-
Method: "POST",
75+
Method: http.MethodPost,
7576
Body: Body{Args: args},
7677
}
7778

0 commit comments

Comments
 (0)